Qt 4.8
|
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit. More...
#include <qtextdocument.h>
Public Types | |
enum | FindFlag { FindBackward = 0x00001, FindCaseSensitively = 0x00002, FindWholeWords = 0x00004 } |
This enum describes the options available to QTextDocument's find function. More... | |
enum | MetaInformation { DocumentTitle, DocumentUrl } |
This enum describes the different types of meta information that can be added to a document. More... | |
enum | ResourceType { HtmlResource = 1, ImageResource = 2, StyleSheetResource = 3, UserResource = 100 } |
This enum describes the types of resources that can be loaded by QTextDocument's loadResource() function. More... | |
enum | Stacks { UndoStack = 0x01, RedoStack = 0x02, UndoAndRedoStacks = UndoStack | RedoStack } |
Public Slots | |
void | appendUndoItem (QAbstractUndoItem *) |
Appends a custom undo item to the undo stack. More... | |
void | redo () |
Redoes the last editing operation on the document if redo is available. More... | |
void | setModified (bool m=true) |
void | undo () |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
Public Slots inherited from QObject | |
void | deleteLater () |
Schedules this object for deletion. More... | |
Signals | |
void | blockCountChanged (int newBlockCount) |
This signal is emitted when the total number of text blocks in the document changes. More... | |
void | contentsChange (int from, int charsRemoves, int charsAdded) |
This signal is emitted whenever the document's content changes; for example, when text is inserted or deleted, or when formatting is applied. More... | |
void | contentsChanged () |
This signal is emitted whenever the document's content changes; for example, when text is inserted or deleted, or when formatting is applied. More... | |
void | cursorPositionChanged (const QTextCursor &cursor) |
This signal is emitted whenever the position of a cursor changed due to an editing operation. More... | |
void | documentLayoutChanged () |
This signal is emitted when a new document layout is set. More... | |
void | modificationChanged (bool m) |
This signal is emitted whenever the content of the document changes in a way that affects the modification state. More... | |
void | redoAvailable (bool) |
This signal is emitted whenever redo operations become available (available is true) or unavailable (available is false). More... | |
void | undoAvailable (bool) |
This signal is emitted whenever undo operations become available (available is true) or unavailable (available is false). More... | |
void | undoCommandAdded () |
This signal is emitted every time a new level of undo is added to the QTextDocument. More... | |
Signals inherited from QObject | |
void | destroyed (QObject *=0) |
This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More... | |
Public Functions | |
void | addResource (int type, const QUrl &name, const QVariant &resource) |
Adds the resource resource to the resource cache, using type and name as identifiers. More... | |
void | adjustSize () |
Adjusts the document to a reasonable size. More... | |
QVector< QTextFormat > | allFormats () const |
Returns a vector of text formats for all the formats used in the document. More... | |
int | availableRedoSteps () const |
Returns the number of available redo steps. More... | |
int | availableUndoSteps () const |
Returns the number of available undo steps. More... | |
QTextBlock | begin () const |
Returns the document's first text block. More... | |
int | blockCount () const |
QChar | characterAt (int pos) const |
Returns the character at position pos, or a null character if the position is out of range. More... | |
int | characterCount () const |
Returns the number of characters of this document. More... | |
virtual void | clear () |
Clears the document. More... | |
void | clearUndoRedoStacks (Stacks historyToClear=UndoAndRedoStacks) |
Clears the stacks specified by stacksToClear. More... | |
QTextDocument * | clone (QObject *parent=0) const |
Creates a new QTextDocument that is a copy of this text document. More... | |
Qt::CursorMoveStyle | defaultCursorMoveStyle () const |
The default cursor movement style is used by all QTextCursor objects created from the document. More... | |
QFont | defaultFont () const |
QString | defaultStyleSheet () const |
QTextOption | defaultTextOption () const |
the default text option will be set on all QTextLayout in the document. More... | |
QTextDocumentPrivate * | docHandle () const |
So that not all classes have to be friends of each other. More... | |
QAbstractTextDocumentLayout * | documentLayout () const |
Returns the document layout for this document. More... | |
qreal | documentMargin () const |
void | drawContents (QPainter *painter, const QRectF &rect=QRectF()) |
Draws the content of the document with painter p, clipped to rect. More... | |
QTextBlock | end () const |
This function returns a block to test for the end of the document while iterating over it. More... | |
QTextCursor | find (const QString &subString, int from=0, FindFlags options=0) const |
Finds the next occurrence of the string, subString, in the document. More... | |
QTextCursor | find (const QString &subString, const QTextCursor &from, FindFlags options=0) const |
Finds the next occurrence of the string, subString, in the document. More... | |
QTextCursor | find (const QRegExp &expr, int from=0, FindFlags options=0) const |
Finds the next occurrence, matching the regular expression, expr, in the document. More... | |
QTextCursor | find (const QRegExp &expr, const QTextCursor &from, FindFlags options=0) const |
Finds the next occurrence, matching the regular expression, expr, in the document. More... | |
QTextBlock | findBlock (int pos) const |
Returns the text block that contains the {pos}-th character. More... | |
QTextBlock | findBlockByLineNumber (int blockNumber) const |
Returns the text block that contains the specified lineNumber. More... | |
QTextBlock | findBlockByNumber (int blockNumber) const |
Returns the text block with the specified blockNumber. More... | |
QTextBlock | firstBlock () const |
Returns the document's first text block. More... | |
QTextFrame * | frameAt (int pos) const |
Returns the frame that contains the text cursor position pos. More... | |
qreal | idealWidth () const |
Returns the ideal width of the text document. More... | |
qreal | indentWidth () const |
bool | isEmpty () const |
Returns true if the document is empty; otherwise returns false. More... | |
bool | isModified () const |
bool | isRedoAvailable () const |
Returns true if redo is available; otherwise returns false. More... | |
bool | isUndoAvailable () const |
Returns true if undo is available; otherwise returns false. More... | |
bool | isUndoRedoEnabled () const |
QTextBlock | lastBlock () const |
Returns the document's last (valid) text block. More... | |
int | lineCount () const |
Returns the number of lines of this document (if the layout supports this). More... | |
void | markContentsDirty (int from, int length) |
Marks the contents specified by the given position and length as "dirty", informing the document that it needs to be laid out again. More... | |
int | maximumBlockCount () const |
QString | metaInformation (MetaInformation info) const |
Returns meta information about the document of the type specified by info. More... | |
QTextObject * | object (int objectIndex) const |
Returns the text object associated with the given objectIndex. More... | |
QTextObject * | objectForFormat (const QTextFormat &) const |
Returns the text object associated with the format f. More... | |
int | pageCount () const |
returns the number of pages in this document. More... | |
QSizeF | pageSize () const |
void | print (QPrinter *printer) const |
Prints the document to the given printer. More... | |
QTextDocument (QObject *parent=0) | |
Constructs an empty QTextDocument with the given parent. More... | |
QTextDocument (const QString &text, QObject *parent=0) | |
Constructs a QTextDocument containing the plain (unformatted) text specified, and with the given parent. More... | |
void | redo (QTextCursor *cursor) |
Redoes the last editing operation on the document if redo is available. More... | |
QVariant | resource (int type, const QUrl &name) const |
Returns data of the specified type from the resource with the given name. More... | |
int | revision () const |
Returns the document's revision (if undo is enabled). More... | |
QTextFrame * | rootFrame () const |
Returns the document's root frame. More... | |
void | setDefaultCursorMoveStyle (Qt::CursorMoveStyle style) |
Sets the default cursor movement style to the given style. More... | |
void | setDefaultFont (const QFont &font) |
Sets the default font to use in the document layout. More... | |
void | setDefaultStyleSheet (const QString &sheet) |
void | setDefaultTextOption (const QTextOption &option) |
Sets the default text option. More... | |
void | setDocumentLayout (QAbstractTextDocumentLayout *layout) |
Sets the document to use the given layout. More... | |
void | setDocumentMargin (qreal margin) |
void | setHtml (const QString &html) |
Replaces the entire contents of the document with the given HTML-formatted text in the html string. More... | |
void | setIndentWidth (qreal width) |
Sets the width used for text list and text block indenting. More... | |
void | setMaximumBlockCount (int maximum) |
void | setMetaInformation (MetaInformation info, const QString &) |
Sets the document's meta information of the type specified by info to the given string. More... | |
void | setPageSize (const QSizeF &size) |
void | setPlainText (const QString &text) |
Replaces the entire contents of the document with the given plain text. More... | |
void | setTextWidth (qreal width) |
void | setUndoRedoEnabled (bool enable) |
void | setUseDesignMetrics (bool b) |
QSizeF | size () const |
qreal | textWidth () const |
QString | toHtml (const QByteArray &encoding=QByteArray()) const |
Returns a string containing an HTML representation of the document. More... | |
QString | toPlainText () const |
Returns the plain text contained in the document. More... | |
void | undo (QTextCursor *cursor) |
Undoes the last editing operation on the document if undo is available. More... | |
bool | useDesignMetrics () const |
~QTextDocument () | |
Destroys the document. More... | |
Public Functions inherited from QObject | |
bool | blockSignals (bool b) |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More... | |
const QObjectList & | children () const |
Returns a list of child objects. More... | |
bool | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0) |
bool | disconnect (const QObject *receiver, const char *member=0) |
void | dumpObjectInfo () |
Dumps information about signal connections, etc. More... | |
void | dumpObjectTree () |
Dumps a tree of children to the debug output. More... | |
QList< QByteArray > | dynamicPropertyNames () const |
Returns the names of all properties that were dynamically added to the object using setProperty(). More... | |
virtual bool | event (QEvent *) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. More... | |
virtual bool | eventFilter (QObject *, QEvent *) |
Filters events if this object has been installed as an event filter for the watched object. More... | |
template<typename T > | |
T | findChild (const QString &aName=QString()) const |
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More... | |
template<typename T > | |
QList< T > | findChildren (const QString &aName=QString()) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More... | |
template<typename T > | |
QList< T > | findChildren (const QRegExp &re) const |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More... | |
void | installEventFilter (QObject *) |
Installs an event filter filterObj on this object. More... | |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false. More... | |
void | killTimer (int id) |
Kills the timer with timer identifier, id. More... | |
virtual const QMetaObject * | metaObject () const |
Returns a pointer to the meta-object of this object. More... | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. More... | |
QString | objectName () const |
QObject * | parent () const |
Returns a pointer to the parent object. More... | |
QVariant | property (const char *name) const |
Returns the value of the object's name property. More... | |
Q_INVOKABLE | QObject (QObject *parent=0) |
Constructs an object with parent object parent. More... | |
void | removeEventFilter (QObject *) |
Removes an event filter object obj from this object. More... | |
void | setObjectName (const QString &name) |
void | setParent (QObject *) |
Makes the object a child of parent. More... | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. More... | |
void | setUserData (uint id, QObjectUserData *data) |
bool | signalsBlocked () const |
Returns true if signals are blocked; otherwise returns false. More... | |
int | startTimer (int interval) |
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More... | |
QThread * | thread () const |
Returns the thread in which the object lives. More... | |
QObjectUserData * | userData (uint id) const |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. More... | |
Protected Functions | |
virtual QTextObject * | createObject (const QTextFormat &f) |
Creates and returns a new document object (a QTextObject), based on the given format. More... | |
virtual QVariant | loadResource (int type, const QUrl &name) |
Loads data of the specified type from the resource with the given name. More... | |
QTextDocument (QTextDocumentPrivate &dd, QObject *parent) | |
Protected Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *) |
This event handler can be reimplemented in a subclass to receive child events. More... | |
virtual void | connectNotify (const char *signal) |
This virtual function is called when something has been connected to signal in this object. More... | |
virtual void | customEvent (QEvent *) |
This event handler can be reimplemented in a subclass to receive custom events. More... | |
virtual void | disconnectNotify (const char *signal) |
This virtual function is called when something has been disconnected from signal in this object. More... | |
QObject (QObjectPrivate &dd, QObject *parent=0) | |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. More... | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More... | |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *) |
This event handler can be reimplemented in a subclass to receive timer events for the object. More... | |
Properties | |
int | blockCount |
Returns the number of text blocks in the document. More... | |
QFont | defaultFont |
the default font used to display the document's text More... | |
QString | defaultStyleSheet |
The default style sheet is applied to all newly HTML formatted text that is inserted into the document, for example using setHtml() or QTextCursor::insertHtml(). More... | |
qreal | documentMargin |
The margin around the document. More... | |
qreal | indentWidth |
Returns the width used for text list and text block indenting. More... | |
int | maximumBlockCount |
Specifies the limit for blocks in the document. More... | |
bool | modified |
whether the document has been modified by the user More... | |
QSizeF | pageSize |
the page size that should be used for laying out the document More... | |
QSizeF | size |
Returns the actual size of the document. More... | |
qreal | textWidth |
The text width specifies the preferred width for text in the document. More... | |
bool | undoRedoEnabled |
whether undo/redo are enabled for this document More... | |
bool | useDesignMetrics |
whether the document uses design metrics of fonts to improve the accuracy of text layout More... | |
Friends | |
class | QTextObjectPrivate |
Additional Inherited Members | |
Static Public Functions inherited from QObject | |
static bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More... | |
static bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
Disconnects signal in object sender from method in object receiver. More... | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static uint | registerUserData () |
static QString | tr (const char *sourceText, const char *comment=0, int n=-1) |
static QString | trUtf8 (const char *sourceText, const char *comment=0, int n=-1) |
Static Public Variables inherited from QObject | |
static const QMetaObject | staticMetaObject |
This variable stores the meta-object for the class. More... | |
Protected Variables inherited from QObject | |
QScopedPointer< QObjectData > | d_ptr |
Static Protected Variables inherited from QObject | |
static const QMetaObject | staticQtMetaObject |
Related Functions inherited from QObject | |
T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QRegExp ®Exp)() |
T * | qobject_cast (QObject *object) |
QObjectList | |
void * | qt_find_obj_child (QObject *parent, const char *type, const QString &name) |
Returns a pointer to the object named name that inherits type and with a given parent. More... | |
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit.
QTextDocument is a container for structured rich text documents, providing support for styled text and various types of document elements, such as lists, tables, frames, and images. They can be created for use in a QTextEdit, or used independently.
Each document element is described by an associated format object. Each format object is treated as a unique object by QTextDocuments, and can be passed to objectForFormat() to obtain the document element that it is applied to.
A QTextDocument can be edited programmatically using a QTextCursor, and its contents can be examined by traversing the document structure. The entire document structure is stored as a hierarchy of document elements beneath the root frame, found with the rootFrame() function. Alternatively, if you just want to iterate over the textual contents of the document you can use begin(), end(), and findBlock() to retrieve text blocks that you can examine and iterate over.
The layout of a document is determined by the documentLayout(); you can create your own QAbstractTextDocumentLayout subclass and set it using setDocumentLayout() if you want to use your own layout logic. The document's title and other meta-information can be obtained by calling the metaInformation() function. For documents that are exposed to users through the QTextEdit class, the document title is also available via the QTextEdit::documentTitle() function.
The toPlainText() and toHtml() convenience functions allow you to retrieve the contents of the document as plain text and HTML. The document's text can be searched using the find() functions.
Undo/redo of operations performed on the document can be controlled using the setUndoRedoEnabled() function. The undo/redo system can be controlled by an editor widget through the undo() and redo() slots; the document also provides contentsChanged(), undoAvailable(), and redoAvailable() signals that inform connected editor widgets about the state of the undo/redo system. The following are the undo/redo operations of a QTextDocument:
Definition at line 109 of file qtextdocument.h.
This enum describes the options available to QTextDocument's find function.
The options can be OR-ed together from the following list:
Enumerator | |
---|---|
FindBackward | |
FindCaseSensitively | |
FindWholeWords |
Definition at line 170 of file qtextdocument.h.
This enum describes the different types of meta information that can be added to a document.
Enumerator | |
---|---|
DocumentTitle | |
DocumentUrl |
Definition at line 153 of file qtextdocument.h.
This enum describes the types of resources that can be loaded by QTextDocument's loadResource() function.
Enumerator | |
---|---|
HtmlResource | |
ImageResource | |
StyleSheetResource | |
UserResource |
Definition at line 213 of file qtextdocument.h.
Enumerator | |
---|---|
UndoStack | |
RedoStack | |
UndoAndRedoStacks |
Definition at line 259 of file qtextdocument.h.
|
explicit |
Constructs an empty QTextDocument with the given parent.
Definition at line 343 of file qtextdocument.cpp.
Referenced by clone().
Constructs a QTextDocument containing the plain (unformatted) text specified, and with the given parent.
Definition at line 354 of file qtextdocument.cpp.
QTextDocument::~QTextDocument | ( | ) |
|
protected |
Definition at line 365 of file qtextdocument.cpp.
Adds the resource resource to the resource cache, using type and name as identifiers.
type should be a value from QTextDocument::ResourceType.
For example, you can add an image as a resource in order to reference it from within the document:
The image can be inserted into the document using the QTextCursor API:
Alternatively, you can insert images using the HTML img
tag:
Definition at line 2108 of file qtextdocument.cpp.
Referenced by getImage(), getPixmap(), and QTextCursor::insertImage().
void QTextDocument::adjustSize | ( | ) |
Adjusts the document to a reasonable size.
Definition at line 880 of file qtextdocument.cpp.
Referenced by QStaticTextPrivate::paintText(), and QWhatsThat::QWhatsThat().
QVector< QTextFormat > QTextDocument::allFormats | ( | ) | const |
Returns a vector of text formats for all the formats used in the document.
Definition at line 3219 of file qtextdocument.cpp.
Referenced by QTextOdfWriter::writeAll().
|
slot |
Appends a custom undo item to the undo stack.
Definition at line 531 of file qtextdocument.cpp.
int QTextDocument::availableRedoSteps | ( | ) | const |
Returns the number of available redo steps.
Definition at line 1182 of file qtextdocument.cpp.
int QTextDocument::availableUndoSteps | ( | ) | const |
Returns the number of available undo steps.
Definition at line 1167 of file qtextdocument.cpp.
QTextBlock QTextDocument::begin | ( | ) | const |
Returns the document's first text block.
Definition at line 1685 of file qtextdocument.cpp.
Referenced by QTextHtmlExporter::emitBlock(), and qTextBlockAt().
int QTextDocument::blockCount | ( | ) | const |
Referenced by adjustSize().
|
signal |
This signal is emitted when the total number of text blocks in the document changes.
The value passed in newBlockCount is the new total.
QChar QTextDocument::characterAt | ( | int | pos | ) | const |
Returns the character at position pos, or a null character if the position is out of range.
Definition at line 992 of file qtextdocument.cpp.
int QTextDocument::characterCount | ( | ) | const |
Returns the number of characters of this document.
Definition at line 975 of file qtextdocument.cpp.
|
virtual |
Clears the document.
Definition at line 420 of file qtextdocument.cpp.
Referenced by QTextControlPrivate::setContent().
void QTextDocument::clearUndoRedoStacks | ( | Stacks | stacksToClear = UndoAndRedoStacks | ) |
Clears the stacks specified by stacksToClear.
This method clears any commands on the undo stack, the redo stack, or both (the default). If commands are cleared, the appropriate signals are emitted, QTextDocument::undoAvailable() or QTextDocument::redoAvailable().
Definition at line 493 of file qtextdocument.cpp.
QTextDocument * QTextDocument::clone | ( | QObject * | parent = 0 | ) | const |
Creates a new QTextDocument that is a copy of this text document.
parent is the parent of the returned text document.
Definition at line 384 of file qtextdocument.cpp.
|
signal |
This signal is emitted whenever the document's content changes; for example, when text is inserted or deleted, or when formatting is applied.
Information is provided about the position of the character in the document where the change occurred, the number of characters removed (charsRemoved), and the number of characters added (charsAdded).
The signal is emitted before the document's layout manager is notified about the change. This hook allows you to implement syntax highlighting for the document.
|
signal |
This signal is emitted whenever the document's content changes; for example, when text is inserted or deleted, or when formatting is applied.
|
protectedvirtual |
Creates and returns a new document object (a QTextObject), based on the given format.
QTextObjects will always get created through this method, so you must reimplement it if you use custom text objects inside your document.
Definition at line 1586 of file qtextdocument.cpp.
Referenced by QTextDocumentPrivate::createObject().
|
signal |
This signal is emitted whenever the position of a cursor changed due to an editing operation.
The cursor that changed is passed in cursor. If you need a signal when the cursor is moved with the arrow keys you can use the QTextEdit::cursorPositionChanged() signal in QTextEdit.
Qt::CursorMoveStyle QTextDocument::defaultCursorMoveStyle | ( | ) | const |
The default cursor movement style is used by all QTextCursor objects created from the document.
The default is Qt::LogicalMoveStyle.
Definition at line 638 of file qtextdocument.cpp.
QFont QTextDocument::defaultFont | ( | ) | const |
Referenced by adjustSize(), and setDefaultFont().
QString QTextDocument::defaultStyleSheet | ( | ) | const |
Referenced by setDefaultStyleSheet().
QTextOption QTextDocument::defaultTextOption | ( | ) | const |
the default text option will be set on all QTextLayout in the document.
The default text option is used on all QTextLayout objects in the document.
When QTextBlock are created, the defaultTextOption is set on their QTextLayout. This allows setting global properties for the document such as the default word wrap mode.
This allows setting global properties for the document such as the default word wrap mode.
Definition at line 607 of file qtextdocument.cpp.
Referenced by QLabelPrivate::ensureTextLayouted(), QPlainTextDocumentLayout::layoutBlock(), QTextEditPrivate::updateDefaultTextOption(), and QPlainTextEditPrivate::updateDefaultTextOption().
QTextDocumentPrivate * QTextDocument::docHandle | ( | ) | const |
So that not all classes have to be friends of each other.
..
Definition at line 3234 of file qtextdocument.cpp.
Referenced by QPlainTextEdit::anchorAt(), begin(), QTextBlockGroup::blockRemoved(), QTextHtmlExporter::emitBlock(), end(), findBlock(), findBlockByLineNumber(), findBlockByNumber(), QTextHtmlExporter::findUrlForImage(), firstBlock(), QTextCursor::insertFragment(), QTextDocumentFragment::isEmpty(), isModified(), lastBlock(), QTextDocumentFragmentPrivate::QTextDocumentFragmentPrivate(), QSyntaxHighlighterPrivate::reformatBlocks(), QAbstractTextDocumentLayoutPrivate::setDocument(), setModified(), QTextHtmlExporter::toHtml(), and QTextOdfWriter::writeAll().
QAbstractTextDocumentLayout * QTextDocument::documentLayout | ( | ) | const |
Returns the document layout for this document.
Definition at line 1223 of file qtextdocument.cpp.
Referenced by QPlainTextEditPrivate::_q_adjustScrollbars(), QTextControlPrivate::_q_documentLayoutChanged(), adjustSize(), QPlainTextEditPrivate::append(), QPlainTextEdit::blockBoundingRect(), boundingRectOfFloatsInSelection(), QTextEngine::docLayout(), documentSize(), drawContents(), getImageSize(), getPixmapSize(), QPlainTextEditControl::hitTest(), idealWidth(), QTextEditPrivate::init(), QPlainTextEditPrivate::init(), QWhatsThat::mouseMoveEvent(), QWhatsThat::mousePressEvent(), QWhatsThat::mouseReleaseEvent(), QAccessibleTextWidget::offsetAtPoint(), pageCount(), QTextEditPrivate::paint(), QGraphicsTextItem::paint(), QWhatsThat::paintEvent(), QPlainTextEdit::paintEvent(), QStaticTextPrivate::paintText(), QTextControl::print(), printPage(), QAccessibleTextEdit::rect(), QTextEditPrivate::relayoutDocument(), QPlainTextEditPrivate::relayoutDocument(), QTextEdit::resizeEvent(), QPlainTextEdit::setDocument(), and QPlainTextEditPrivate::verticalOffset().
|
signal |
qreal QTextDocument::documentMargin | ( | ) | const |
Referenced by idealWidth().
Draws the content of the document with painter p, clipped to rect.
If rect is a null rectangle (default) then the document is painted unclipped.
Definition at line 724 of file qtextdocument.cpp.
Referenced by QSplashScreen::drawContents().
QTextBlock QTextDocument::end | ( | ) | const |
This function returns a block to test for the end of the document while iterating over it.
The block returned is invalid and represents the block after the last block in the document. You can use lastBlock() to retrieve the last valid block of the document.
Definition at line 1703 of file qtextdocument.cpp.
Referenced by findInBlock(), and formatDifference().
QTextCursor QTextDocument::find | ( | const QString & | subString, |
int | position = 0 , |
||
FindFlags | options = 0 |
||
) | const |
Finds the next occurrence of the string, subString, in the document.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The search starts at the given position, and proceeds forwards through the document unless specified otherwise in the search options. The options control the type of search performed.
Returns a cursor with the match selected if subString was found; otherwise returns a null cursor.
If the position is 0 (the default) the search begins from the beginning of the document; otherwise it begins at the specified position.
Definition at line 1402 of file qtextdocument.cpp.
Referenced by QLabelPrivate::ensureTextPopulated(), and find().
QTextCursor QTextDocument::find | ( | const QString & | subString, |
const QTextCursor & | cursor, | ||
FindFlags | options = 0 |
||
) | const |
Finds the next occurrence of the string, subString, in the document.
The search starts at the position of the given cursor, and proceeds forwards through the document unless specified otherwise in the search options. The options control the type of search performed.
Returns a cursor with the match selected if subString was found; otherwise returns a null cursor.
If the given cursor has a selection, the search begins after the selection; otherwise it begins at the cursor's position.
By default the search is case-sensitive, and can match text anywhere in the document.
Definition at line 1431 of file qtextdocument.cpp.
QTextCursor QTextDocument::find | ( | const QRegExp & | expr, |
int | position = 0 , |
||
FindFlags | options = 0 |
||
) | const |
Finds the next occurrence, matching the regular expression, expr, in the document.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
The search starts at the given position, and proceeds forwards through the document unless specified otherwise in the search options. The options control the type of search performed. The FindCaseSensitively option is ignored for this overload, use QRegExp::caseSensitivity instead.
Returns a cursor with the match selected if a match was found; otherwise returns a null cursor.
If the position is 0 (the default) the search begins from the beginning of the document; otherwise it begins at the specified position.
Definition at line 1503 of file qtextdocument.cpp.
QTextCursor QTextDocument::find | ( | const QRegExp & | expr, |
const QTextCursor & | cursor, | ||
FindFlags | options = 0 |
||
) | const |
Finds the next occurrence, matching the regular expression, expr, in the document.
The search starts at the position of the given cursor, and proceeds forwards through the document unless specified otherwise in the search options. The options control the type of search performed. The FindCaseSensitively option is ignored for this overload, use QRegExp::caseSensitivity instead.
Returns a cursor with the match selected if a match was found; otherwise returns a null cursor.
If the given cursor has a selection, the search begins after the selection; otherwise it begins at the cursor's position.
By default the search is case-sensitive, and can match text anywhere in the document.
Definition at line 1564 of file qtextdocument.cpp.
QTextBlock QTextDocument::findBlock | ( | int | pos | ) | const |
Returns the text block that contains the {pos}-th character.
Definition at line 1644 of file qtextdocument.cpp.
Referenced by QAccessibleTextWidget::characterRect(), QTextDocumentLayout::documentChanged(), QPlainTextDocumentLayout::documentChanged(), QPlainTextEditPrivate::ensureVisible(), and QSyntaxHighlighterPrivate::reformatBlocks().
QTextBlock QTextDocument::findBlockByLineNumber | ( | int | lineNumber | ) | const |
Returns the text block that contains the specified lineNumber.
Definition at line 1674 of file qtextdocument.cpp.
Referenced by QPlainTextEditPrivate::setTopBlock(), and QPlainTextEditPrivate::setTopLine().
QTextBlock QTextDocument::findBlockByNumber | ( | int | blockNumber | ) | const |
Returns the text block with the specified blockNumber.
Definition at line 1659 of file qtextdocument.cpp.
Referenced by QPlainTextEditControl::blockBoundingRect(), QPlainTextEditControl::firstVisibleBlock(), QScriptEdit::gotoLine(), QPlainTextEditControl::hitTest(), QPlainTextEditPrivate::setTopBlock(), and QPlainTextEditPrivate::verticalOffset().
QTextBlock QTextDocument::firstBlock | ( | ) | const |
Returns the document's first text block.
Definition at line 1715 of file qtextdocument.cpp.
Referenced by QPlainTextDocumentLayout::documentChanged(), QPlainTextDocumentLayout::layoutBlock(), and QPlainTextDocumentLayoutPrivate::relayout().
QTextFrame * QTextDocument::frameAt | ( | int | pos | ) | const |
Returns the frame that contains the text cursor position pos.
Definition at line 1607 of file qtextdocument.cpp.
qreal QTextDocument::idealWidth | ( | ) | const |
Returns the ideal width of the text document.
The ideal width is the actually used width of the document without optional alignments taken into account. It is always <= size().width().
Definition at line 786 of file qtextdocument.cpp.
Referenced by adjustSize().
qreal QTextDocument::indentWidth | ( | ) | const |
Referenced by setDocumentMargin().
bool QTextDocument::isEmpty | ( | ) | const |
Returns true if the document is empty; otherwise returns false.
Definition at line 409 of file qtextdocument.cpp.
Referenced by QPlainTextEdit::keyPressEvent(), and QTextEdit::keyPressEvent().
bool QTextDocument::isModified | ( | ) | const |
Definition at line 1818 of file qtextdocument.cpp.
bool QTextDocument::isRedoAvailable | ( | ) | const |
Returns true if redo is available; otherwise returns false.
Definition at line 1152 of file qtextdocument.cpp.
bool QTextDocument::isUndoAvailable | ( | ) | const |
Returns true if undo is available; otherwise returns false.
Definition at line 1141 of file qtextdocument.cpp.
bool QTextDocument::isUndoRedoEnabled | ( | ) | const |
Definition at line 553 of file qtextdocument.cpp.
Referenced by QTextEdit::isUndoRedoEnabled(), and QTextControlPrivate::setContent().
QTextBlock QTextDocument::lastBlock | ( | ) | const |
Returns the document's last (valid) text block.
Definition at line 1728 of file qtextdocument.cpp.
Referenced by QPlainTextEditPrivate::_q_adjustScrollbars(), and QPlainTextEditPrivate::append().
int QTextDocument::lineCount | ( | ) | const |
Returns the number of lines of this document (if the layout supports this).
Otherwise, this is identical to the number of blocks.
Definition at line 959 of file qtextdocument.cpp.
Referenced by QPlainTextEditPrivate::_q_adjustScrollbars(), QPlainTextDocumentLayout::layoutBlock(), and QDeclarativeTextPrivate::setupTextLayout().
Loads data of the specified type from the resource with the given name.
This function is called by the rich text engine to request data that isn't directly stored by QTextDocument, but still associated with it. For example, images are referenced indirectly by the name attribute of a QTextImageFormat object.
When called by Qt, type is one of the values of QTextDocument::ResourceType.
If the QTextDocument is a child object of a QTextEdit, QTextBrowser, or a QTextDocument itself then the default implementation tries to retrieve the data from the parent.
Reimplemented in QTextDocumentWithImageResources.
Definition at line 2131 of file qtextdocument.cpp.
Referenced by QTextDocumentWithImageResources::loadResource(), and loadResource().
void QTextDocument::markContentsDirty | ( | int | from, |
int | length | ||
) |
Marks the contents specified by the given position and length as "dirty", informing the document that it needs to be laid out again.
Definition at line 668 of file qtextdocument.cpp.
Referenced by QSyntaxHighlighterPrivate::applyFormatChanges().
int QTextDocument::maximumBlockCount | ( | ) | const |
Referenced by isUndoRedoEnabled().
QString QTextDocument::metaInformation | ( | MetaInformation | info | ) | const |
Returns meta information about the document of the type specified by info.
Definition at line 1240 of file qtextdocument.cpp.
Referenced by QTextEdit::documentTitle(), QTextControl::print(), and QTextHtmlExporter::toHtml().
|
signal |
This signal is emitted whenever the content of the document changes in a way that affects the modification state.
If changed is true, the document has been modified; otherwise it is false.
For example, calling setModified(false) on a document and then inserting text causes the signal to get emitted. If you undo that operation, causing the document to return to its original unmodified state, the signal will get emitted again.
QTextObject * QTextDocument::object | ( | int | objectIndex | ) | const |
Returns the text object associated with the given objectIndex.
Definition at line 1625 of file qtextdocument.cpp.
QTextObject * QTextDocument::objectForFormat | ( | const QTextFormat & | f | ) | const |
Returns the text object associated with the format f.
Definition at line 1634 of file qtextdocument.cpp.
Referenced by QTextDocumentLayoutPrivate::blockIndent(), QTextDocumentLayoutPrivate::drawBlock(), QTextDocumentLayoutPrivate::drawListItem(), QTextHtmlExporter::emitFragment(), QTextBlock::textList(), and QTextOdfWriter::writeAll().
int QTextDocument::pageCount | ( | ) | const |
returns the number of pages in this document.
Definition at line 1764 of file qtextdocument.cpp.
QSizeF QTextDocument::pageSize | ( | ) | const |
Referenced by setPageSize().
void QTextDocument::print | ( | QPrinter * | printer | ) | const |
Prints the document to the given printer.
The QPrinter must be set up before being used with this function.
This is only a convenience method to print the whole document to the printer.
If the document is already paginated through a specified height in the pageSize() property it is printed as-is.
If the document is not paginated, like for example a document used in a QTextEdit, then a temporary copy of the document is created and the copy is broken into multiple pages according to the size of the QPrinter's paperRect(). By default a 2 cm margin is set around the document contents. In addition the current page number is printed at the bottom of each page.
Note that QPrinter::Selection is not supported as print range with this function since the selection is a property of QTextCursor. If you have a QTextEdit associated with your QTextDocument then you can use QTextEdit's print() function because QTextEdit has access to the user's selection.
Definition at line 1884 of file qtextdocument.cpp.
Referenced by QTextControl::print().
void QTextDocument::redo | ( | QTextCursor * | cursor | ) |
Redoes the last editing operation on the document if redo is available.
The provided cursor is positioned at the end of the location where the edition operation was redone.
Definition at line 462 of file qtextdocument.cpp.
|
slot |
Redoes the last editing operation on the document if redo is available.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 517 of file qtextdocument.cpp.
|
signal |
This signal is emitted whenever redo operations become available (available is true) or unavailable (available is false).
Returns data of the specified type from the resource with the given name.
This function is called by the rich text engine to request data that isn't directly stored by QTextDocument, but still associated with it. For example, images are referenced indirectly by the name attribute of a QTextImageFormat object.
Resources are cached internally in the document. If a resource can not be found in the cache, loadResource is called to try to load the resource. loadResource should then use addResource to add the resource to the cache.
Definition at line 2078 of file qtextdocument.cpp.
Referenced by QTextHtmlParserNode::applyBackgroundImage(), getImage(), and getPixmap().
int QTextDocument::revision | ( | ) | const |
Returns the document's revision (if undo is enabled).
The revision is guaranteed to increase when a document that is not modified is edited.
Definition at line 1200 of file qtextdocument.cpp.
QTextFrame * QTextDocument::rootFrame | ( | ) | const |
Returns the document's root frame.
Definition at line 1616 of file qtextdocument.cpp.
Referenced by clone(), QTextHtmlImporter::closeTag(), QTextDocumentLayoutPrivate::drawBlock(), QTextHtmlExporter::emitFrame(), QLabelPrivate::ensureTextLayouted(), QTextDocumentLayoutPrivate::frameIteratorForYPosition(), QTextDocumentLayoutPrivate::layoutFlow(), QTextHtmlImporter::processSpecialNodes(), setDocumentMargin(), QTextHtmlExporter::toHtml(), QTextOdfWriter::writeAll(), and QTextOdfWriter::writeFrame().
void QTextDocument::setDefaultCursorMoveStyle | ( | Qt::CursorMoveStyle | style | ) |
Sets the default cursor movement style to the given style.
Definition at line 652 of file qtextdocument.cpp.
void QTextDocument::setDefaultFont | ( | const QFont & | font | ) |
Sets the default font to use in the document layout.
Definition at line 1772 of file qtextdocument.cpp.
Referenced by QTextEditPrivate::init(), QPlainTextEditPrivate::init(), QStaticTextPrivate::paintText(), QTextControl::print(), QWhatsThat::QWhatsThat(), and QGraphicsTextItem::setFont().
void QTextDocument::setDefaultStyleSheet | ( | const QString & | sheet | ) |
Definition at line 1023 of file qtextdocument.cpp.
Referenced by QStaticTextPrivate::paintText().
void QTextDocument::setDefaultTextOption | ( | const QTextOption & | option | ) |
Sets the default text option.
Definition at line 621 of file qtextdocument.cpp.
Referenced by QLabelPrivate::ensureTextLayouted(), QStaticTextPrivate::paintText(), QTextEditPrivate::updateDefaultTextOption(), and QPlainTextEditPrivate::updateDefaultTextOption().
void QTextDocument::setDocumentLayout | ( | QAbstractTextDocumentLayout * | layout | ) |
Sets the document to use the given layout.
The previous layout is deleted.
Definition at line 1214 of file qtextdocument.cpp.
Referenced by QPlainTextEditPrivate::init(), and QPlainTextEdit::setDocument().
void QTextDocument::setDocumentMargin | ( | qreal | margin | ) |
Definition at line 808 of file qtextdocument.cpp.
Referenced by QStaticTextPrivate::paintText().
void QTextDocument::setHtml | ( | const QString & | html | ) |
Replaces the entire contents of the document with the given HTML-formatted text in the html string.
The HTML formatting is respected as much as possible; for example, "<b>bold</b> text" will produce text where the first word has a font weight that gives it a bold appearance: "<b>bold</b> text".
Definition at line 1338 of file qtextdocument.cpp.
Referenced by QSplashScreen::drawContents(), QLabelPrivate::ensureTextPopulated(), handleStringAttribute(), QStaticTextPrivate::paintText(), QWhatsThat::QWhatsThat(), QTextDocumentWithImageResources::requestFinished(), QTextControlPrivate::setContent(), QTextDocumentWithImageResources::setText(), and QAccessibleDisplay::text().
void QTextDocument::setIndentWidth | ( | qreal | width | ) |
Sets the width used for text list and text block indenting.
The indent properties of QTextListFormat and QTextBlockFormat specify multiples of this value. The default indent width is 40 .
Definition at line 857 of file qtextdocument.cpp.
void QTextDocument::setMaximumBlockCount | ( | int | maximum | ) |
Definition at line 589 of file qtextdocument.cpp.
Referenced by QPlainTextEditPrivate::append().
void QTextDocument::setMetaInformation | ( | MetaInformation | info, |
const QString & | string | ||
) |
Sets the document's meta information of the type specified by info to the given string.
Definition at line 1258 of file qtextdocument.cpp.
Referenced by QTextHtmlImporter::import(), QTextControl::print(), and QTextEdit::setDocumentTitle().
|
slot |
Definition at line 1823 of file qtextdocument.cpp.
Referenced by QTextControlPrivate::setContent().
void QTextDocument::setPageSize | ( | const QSizeF & | size | ) |
Definition at line 1747 of file qtextdocument.cpp.
Referenced by QTextEditPrivate::init(), QTextControl::print(), QTextEditPrivate::relayoutDocument(), and setTextWidth().
void QTextDocument::setPlainText | ( | const QString & | text | ) |
Replaces the entire contents of the document with the given plain text.
Definition at line 1309 of file qtextdocument.cpp.
Referenced by QSplashScreen::drawContents(), QLabelPrivate::ensureTextPopulated(), QStaticTextPrivate::paintText(), QWhatsThat::QWhatsThat(), QTextDocumentWithImageResources::requestFinished(), QTextControlPrivate::setContent(), and QTextDocumentWithImageResources::setText().
void QTextDocument::setTextWidth | ( | qreal | width | ) |
Definition at line 760 of file qtextdocument.cpp.
Referenced by adjustSize(), QSplashScreen::drawContents(), QLabelPrivate::ensureTextLayouted(), QPlainTextEditPrivate::init(), and QStaticTextPrivate::paintText().
void QTextDocument::setUndoRedoEnabled | ( | bool | enable | ) |
Definition at line 547 of file qtextdocument.cpp.
Referenced by QLabelPrivate::ensureTextPopulated(), QTextEditPrivate::init(), QTextControlPrivate::init(), QTextDocumentFragmentPrivate::QTextDocumentFragmentPrivate(), QWhatsThat::QWhatsThat(), QTextControlPrivate::setContent(), setMaximumBlockCount(), and QTextEdit::setUndoRedoEnabled().
void QTextDocument::setUseDesignMetrics | ( | bool | b | ) |
Definition at line 699 of file qtextdocument.cpp.
Referenced by QTextControl::print().
QSizeF QTextDocument::size | ( | ) | const |
qreal QTextDocument::textWidth | ( | ) | const |
Referenced by idealWidth(), and setTextWidth().
QString QTextDocument::toHtml | ( | const QByteArray & | encoding = QByteArray() | ) | const |
Returns a string containing an HTML representation of the document.
The encoding parameter specifies the value for the charset attribute in the html header. For example if 'utf-8' is specified then the beginning of the generated html will look like this:
If no encoding is specified then no such meta information is generated.
If you later on convert the returned html string into a byte array for transmission over a network or when saving to disk you should specify the encoding you're going to use for the conversion to a byte array here.
Definition at line 3210 of file qtextdocument.cpp.
Referenced by QTextEdit::toHtml(), and QTextDocumentWriter::write().
QString QTextDocument::toPlainText | ( | ) | const |
Returns the plain text contained in the document.
If you want formatting information use a QTextCursor instead.
Definition at line 1277 of file qtextdocument.cpp.
Referenced by handleStringAttribute(), QAccessibleDisplay::text(), QTextDocumentFragment::toPlainText(), QTextEdit::toPlainText(), and QTextDocumentWriter::write().
void QTextDocument::undo | ( | QTextCursor * | cursor | ) |
Undoes the last editing operation on the document if undo is available.
The provided cursor is positioned at the end of the location where the edition operation was undone.
See the Overview of Qt's Undo Framework documentation for details.
Definition at line 441 of file qtextdocument.cpp.
|
slot |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 503 of file qtextdocument.cpp.
|
signal |
This signal is emitted whenever undo operations become available (available is true) or unavailable (available is false).
See the Overview of Qt's Undo Framework documentation for details.
|
signal |
This signal is emitted every time a new level of undo is added to the QTextDocument.
Referenced by QTextDocumentPrivate::appendUndoItem(), and QTextDocumentPrivate::endEditBlock().
bool QTextDocument::useDesignMetrics | ( | ) | const |
Referenced by setUseDesignMetrics().
|
friend |
Definition at line 303 of file qtextdocument.h.
|
private |
Returns the number of text blocks in the document.
The value of this property is undefined in documents with tables or frames.
By default, if defined, this property contains a value of 1.
Definition at line 120 of file qtextdocument.h.
Referenced by QPlainTextEditPrivate::append(), QPlainTextEdit::blockBoundingRect(), QAccessibleTextEdit::childCount(), and QPlainTextDocumentLayout::documentChanged().
|
private |
the default font used to display the document's text
Returns the default font to be used in the document layout.
Definition at line 116 of file qtextdocument.h.
Referenced by QGraphicsTextItem::font(), QTextControl::print(), printPage(), and QTextHtmlExporter::QTextHtmlExporter().
|
private |
The default style sheet is applied to all newly HTML formatted text that is inserted into the document, for example using setHtml() or QTextCursor::insertHtml().
The style sheet needs to be compliant to CSS 2.1 syntax.
Note: Changing the default style sheet does not have any effect to the existing content of the document.
Definition at line 123 of file qtextdocument.h.
|
private |
The margin around the document.
The default is 4.
Definition at line 126 of file qtextdocument.h.
Referenced by QPlainTextEditPrivate::_q_adjustScrollbars(), QPlainTextDocumentLayout::blockBoundingRect(), QPlainTextDocumentLayout::documentChanged(), QPlainTextDocumentLayout::layoutBlock(), QPlainTextEdit::paintEvent(), QTextHtmlExporter::toHtml(), and QPlainTextEditPrivate::verticalOffset().
|
private |
Returns the width used for text list and text block indenting.
The indent properties of QTextListFormat and QTextBlockFormat specify multiples of this value. The default indent width is 40.
Definition at line 121 of file qtextdocument.h.
Referenced by QTextDocumentLayoutPrivate::blockIndent().
|
private |
Specifies the limit for blocks in the document.
Specifies the maximum number of blocks the document may have. If there are more blocks in the document that specified with this property blocks are removed from the beginning of the document.
A negative or zero value specifies that the document may contain an unlimited amount of blocks.
The default value is 0.
Note that setting this property will apply the limit immediately to the document contents.
Setting this property also disables the undo redo history.
This property is undefined in documents with tables or frames.
Definition at line 125 of file qtextdocument.h.
Referenced by QPlainTextEditPrivate::append().
|
private |
whether the document has been modified by the user
By default, this property is false.
Definition at line 114 of file qtextdocument.h.
|
private |
the page size that should be used for laying out the document
By default, for a newly-created, empty document, this property contains an undefined size.
Definition at line 115 of file qtextdocument.h.
Referenced by QGraphicsTextItemPrivate::controlOffset(), QTextDocumentLayoutPrivate::drawBlock(), QTextDocumentLayoutPrivate::drawBorder(), QTextDocumentLayoutPrivate::drawFrame(), QTextDocumentLayoutPrivate::drawListItem(), QTextDocumentLayoutPrivate::layoutBlock(), QTextDocumentLayoutPrivate::layoutCell(), QTextDocumentLayoutPrivate::layoutFlow(), QTextDocumentLayoutPrivate::layoutFrame(), QTextDocumentLayoutPrivate::layoutTable(), QTextControl::print(), and QTextEdit::resizeEvent().
|
private |
Returns the actual size of the document.
This is equivalent to documentLayout()->documentSize();
The size of the document can be changed either by setting a text width or setting an entire page size.
Note that the width is always >= pageSize().width().
By default, for a newly-created, empty document, this property contains a configuration-dependent size.
Definition at line 118 of file qtextdocument.h.
Referenced by QStaticTextPrivate::paintText(), and QWhatsThat::QWhatsThat().
|
private |
The text width specifies the preferred width for text in the document.
If the text (or content in general) is wider than the specified with it is broken into multiple lines and grows vertically. If the text cannot be broken into multiple lines to fit into the specified text width it will be larger and the size() and the idealWidth() property will reflect that.
If the text width is set to -1 then the text will not be broken into multiple lines unless it is enforced through an explicit line break or a new paragraph.
The default value is -1.
Setting the text width will also set the page height to -1, causing the document to grow or shrink vertically in a continuous way. If you want the document layout to break the text into multiple pages then you have to set the pageSize property instead.
Definition at line 119 of file qtextdocument.h.
|
private |
whether undo/redo are enabled for this document
This defaults to true. If disabled, the undo stack is cleared and no items will be added to it.
Definition at line 113 of file qtextdocument.h.
|
private |
whether the document uses design metrics of fonts to improve the accuracy of text layout
If this property is set to true, the layout will use design metrics. Otherwise, the metrics of the paint device as set on QAbstractTextDocumentLayout::setPaintDevice() will be used.
Using design metrics makes a layout have a width that is no longer dependent on hinting and pixel-rounding. This means that WYSIWYG text layout becomes possible because the width scales much more linearly based on paintdevice metrics than it would otherwise.
By default, this property is false.
Definition at line 117 of file qtextdocument.h.
Referenced by QTextControl::print().