- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | Friends

# QTextDocument Class Reference

Search for all occurrences

## Detailed Description

Definition at line 109 of file qtextdocument.h.

`#include <qtextdocument.h>`

Inheritance diagram for QTextDocument:
[legend]

List of all members.

## Public Types
enum | MetaInformation { DocumentTitle, DocumentUrl }
enum | FindFlag { FindBackward = 0x00001, FindCaseSensitively = 0x00002, FindWholeWords = 0x00004 }
enum | ResourceType { HtmlResource = 1, ImageResource = 2, StyleSheetResource = 3, UserResource = 100 }
enum | Stacks { UndoStack = 0x01, RedoStack = 0x02, UndoAndRedoStacks = UndoStack | RedoStack }
## Public Slots
void | undo ()
void | redo ()
void | appendUndoItem (QAbstractUndoItem *)
void | setModified (bool m=true)
## Signals
void | contentsChange (int from, int charsRemoves, int charsAdded)
void | contentsChanged ()
void | undoAvailable (bool)
void | redoAvailable (bool)
void | undoCommandAdded ()
void | modificationChanged (bool m)
void | cursorPositionChanged (const QTextCursor &cursor)
void | blockCountChanged (int newBlockCount)
void | documentLayoutChanged ()
## Public Member Functions
| QTextDocument (QObject *parent=0)
| QTextDocument (const QString &text, QObject *parent=0)
| ~QTextDocument ()
QTextDocument * | clone (QObject *parent=0) const
bool | isEmpty () const
virtual void | clear ()
void | setUndoRedoEnabled (bool enable)
bool | isUndoRedoEnabled () const
bool | isUndoAvailable () const
bool | isRedoAvailable () const
int | availableUndoSteps () const
int | availableRedoSteps () const
int | revision () const
void | setDocumentLayout (QAbstractTextDocumentLayout *layout)
QAbstractTextDocumentLayout * | documentLayout () const
void | setMetaInformation (MetaInformation info, const QString &)
QString | metaInformation (MetaInformation info) const
QString | toHtml (const QByteArray &encoding=QByteArray()) const
void | setHtml (const QString &html)
QString | toPlainText () const
void | setPlainText (const QString &text)
QChar | characterAt (int pos) const
QTextCursor | find (const QString &subString, int from=0, FindFlags options=0) const
QTextCursor | find (const QString &subString, const QTextCursor &from, FindFlags options=0) const
QTextCursor | find (const QRegExp &expr, int from=0, FindFlags options=0) const
QTextCursor | find (const QRegExp &expr, const QTextCursor &from, FindFlags options=0) const
QTextFrame * | frameAt (int pos) const
QTextFrame * | rootFrame () const
QTextObject * | object (int objectIndex) const
QTextObject * | objectForFormat (const QTextFormat &) const
QTextBlock | findBlock (int pos) const
QTextBlock | findBlockByNumber (int blockNumber) const
QTextBlock | findBlockByLineNumber (int blockNumber) const
QTextBlock | begin () const
QTextBlock | end () const
QTextBlock | firstBlock () const
QTextBlock | lastBlock () const
void | setPageSize (const QSizeF &size)
QSizeF | pageSize () const
void | setDefaultFont (const QFont &font)
QFont | defaultFont () const
int | pageCount () const
bool | isModified () const
void | print (QPrinter *printer) const
QVariant | resource (int type, const QUrl &name) const
void | addResource (int type, const QUrl &name, const QVariant &resource)
QVector< QTextFormat > | allFormats () const
void | markContentsDirty (int from, int length)
void | setUseDesignMetrics (bool b)
bool | useDesignMetrics () const
void | drawContents (QPainter *painter, const QRectF &rect=QRectF())
void | setTextWidth (qreal width)
qreal | textWidth () const
qreal | idealWidth () const
qreal | indentWidth () const
void | setIndentWidth (qreal width)
qreal | documentMargin () const
void | setDocumentMargin (qreal margin)
void | adjustSize ()
QSizeF | size () const
int | blockCount () const
int | lineCount () const
int | characterCount () const
void | setDefaultStyleSheet (const QString &sheet)
QString | defaultStyleSheet () const
void | undo (QTextCursor *cursor)
void | redo (QTextCursor *cursor)
void | clearUndoRedoStacks (Stacks historyToClear=UndoAndRedoStacks)
int | maximumBlockCount () const
void | setMaximumBlockCount (int maximum)
QTextOption | defaultTextOption () const
void | setDefaultTextOption (const QTextOption &option)
QTextDocumentPrivate * | docHandle () const
## Protected Member Functions
virtual QTextObject * | createObject (const QTextFormat &f)
virtual QVariant | loadResource (int type, const QUrl &name)
| QTextDocument (QTextDocumentPrivate &dd, QObject *parent)
## Properties
bool | undoRedoEnabled
bool | modified
QSizeF | pageSize
QFont | defaultFont
bool | useDesignMetrics
QSizeF | size
qreal | textWidth
int | blockCount
qreal | indentWidth
QString | defaultStyleSheet
int | maximumBlockCount
qreal | documentMargin
## Friends
class | QTextObjectPrivate

## Member Enumeration Documentation

enum MetaInformation

Search for all occurrences

Enumerator:

  DocumentTitle | Search for all occurrences
  DocumentUrl | Search for all occurrences

Definition at line 153 of file qtextdocument.h.

                             {
            DocumentTitle,
            DocumentUrl
        };

enum FindFlag

Search for all occurrences

Enumerator:

  FindBackward | Search for all occurrences
  FindCaseSensitively | Search for all occurrences
  FindWholeWords | Search for all occurrences

Definition at line 170 of file qtextdocument.h.

        {
            FindBackward        = 0x00001,
            FindCaseSensitively = 0x00002,
            FindWholeWords      = 0x00004
        };

enum ResourceType

Search for all occurrences

Enumerator:

  HtmlResource | Search for all occurrences
  ImageResource | Search for all occurrences
  StyleSheetResource | Search for all occurrences
  UserResource | Search for all occurrences

Definition at line 213 of file qtextdocument.h.

                          {
            HtmlResource  = 1,
            ImageResource = 2,
            StyleSheetResource = 3,

            UserResource  = 100
        };

enum Stacks

Search for all occurrences

Enumerator:

  UndoStack | Search for all occurrences
  RedoStack | Search for all occurrences
  UndoAndRedoStacks | Search for all occurrences

Definition at line 259 of file qtextdocument.h.

                    {
            UndoStack = 0x01,
            RedoStack = 0x02,
            UndoAndRedoStacks = UndoStack | RedoStack
        };

## Constructor & Destructor Documentation

QTextDocument | ( | QObject * | parent = `0` | ) | `[explicit]`

QTextDocument | ( | const QString & | text,
|  | QObject * | parent = `0`
| ) |  | `[explicit]`

~QTextDocument | ( |  | ) |

QTextDocument | ( | QTextDocumentPrivate & | dd,
|  | QObject * | parent
| ) |  | `[protected]`

## Member Function Documentation

QTextDocument* clone | ( | QObject * | parent = `0` | ) | const

Search for all occurrences

bool isEmpty | ( |  | ) | const

Search for all occurrences

virtual void clear | ( |  | ) | `[virtual]`

Search for all occurrences

void setUndoRedoEnabled | ( | bool | enable | ) |

Search for all occurrences

bool isUndoRedoEnabled | ( |  | ) | const

Search for all occurrences

bool isUndoAvailable | ( |  | ) | const

Search for all occurrences

bool isRedoAvailable | ( |  | ) | const

Search for all occurrences

int availableUndoSteps | ( |  | ) | const

Search for all occurrences

int availableRedoSteps | ( |  | ) | const

Search for all occurrences

int revision | ( |  | ) | const

Search for all occurrences

void setDocumentLayout | ( | QAbstractTextDocumentLayout * | layout | ) |

Search for all occurrences

QAbstractTextDocumentLayout* documentLayout | ( |  | ) | const

Search for all occurrences

void setMetaInformation | ( | MetaInformation | info,
|  | const QString & |
| ) |  |

Search for all occurrences

QString metaInformation | ( | MetaInformation | info | ) | const

Search for all occurrences

QString toHtml | ( | const QByteArray & | encoding = `QByteArray()` | ) | const

Search for all occurrences

void setHtml | ( | const QString & | html | ) |

Search for all occurrences

QString toPlainText | ( |  | ) | const

Search for all occurrences

void setPlainText | ( | const QString & | text | ) |

Search for all occurrences

QChar characterAt | ( | int | pos | ) | const

Search for all occurrences

QTextCursor find | ( | const QString & | subString,
|  | int | from = `0`,
|  | FindFlags | options = `0`
| ) |  | const

Search for all occurrences

QTextCursor find | ( | const QString & | subString,
|  | const QTextCursor & | from,
|  | FindFlags | options = `0`
| ) |  | const

Search for all occurrences

QTextCursor find | ( | const QRegExp & | expr,
|  | int | from = `0`,
|  | FindFlags | options = `0`
| ) |  | const

Search for all occurrences

QTextCursor find | ( | const QRegExp & | expr,
|  | const QTextCursor & | from,
|  | FindFlags | options = `0`
| ) |  | const

Search for all occurrences

QTextFrame* frameAt | ( | int | pos | ) | const

Search for all occurrences

QTextFrame* rootFrame | ( |  | ) | const

Search for all occurrences

QTextObject* object | ( | int | objectIndex | ) | const

Search for all occurrences

QTextObject* objectForFormat | ( | const QTextFormat & |  | ) | const

Search for all occurrences

QTextBlock findBlock | ( | int | pos | ) | const

Search for all occurrences

QTextBlock findBlockByNumber | ( | int | blockNumber | ) | const

Search for all occurrences

QTextBlock findBlockByLineNumber | ( | int | blockNumber | ) | const

Search for all occurrences

QTextBlock begin | ( |  | ) | const

Search for all occurrences

QTextBlock end | ( |  | ) | const

Search for all occurrences

QTextBlock firstBlock | ( |  | ) | const

Search for all occurrences

QTextBlock lastBlock | ( |  | ) | const

Search for all occurrences

void setPageSize | ( | const QSizeF & | size | ) |

Search for all occurrences

QSizeF pageSize | ( |  | ) | const

Search for all occurrences

void setDefaultFont | ( | const QFont & | font | ) |

Search for all occurrences

QFont defaultFont | ( |  | ) | const

Search for all occurrences

int pageCount | ( |  | ) | const

Search for all occurrences

bool isModified | ( |  | ) | const

Search for all occurrences

void print | ( | QPrinter * | printer | ) | const

Search for all occurrences

QVariant resource | ( | int | type,
|  | const QUrl & | name
| ) |  | const

Search for all occurrences

void addResource | ( | int | type,
|  | const QUrl & | name,
|  | const QVariant & | resource
| ) |  |

Search for all occurrences

QVector<QTextFormat> allFormats | ( |  | ) | const

Search for all occurrences

void markContentsDirty | ( | int | from,
|  | int | length
| ) |  |

Search for all occurrences

void setUseDesignMetrics | ( | bool | b | ) |

Search for all occurrences

bool useDesignMetrics | ( |  | ) | const

Search for all occurrences

void drawContents | ( | QPainter * | painter,
|  | const QRectF & | rect = `QRectF()`
| ) |  |

Search for all occurrences

void setTextWidth | ( | qreal | width | ) |

Search for all occurrences

qreal textWidth | ( |  | ) | const

Search for all occurrences

qreal idealWidth | ( |  | ) | const

Search for all occurrences

qreal indentWidth | ( |  | ) | const

Search for all occurrences

void setIndentWidth | ( | qreal | width | ) |

Search for all occurrences

qreal documentMargin | ( |  | ) | const

Search for all occurrences

void setDocumentMargin | ( | qreal | margin | ) |

Search for all occurrences

void adjustSize | ( |  | ) |

Search for all occurrences

QSizeF size | ( |  | ) | const

Search for all occurrences

int blockCount | ( |  | ) | const

Search for all occurrences

int lineCount | ( |  | ) | const

Search for all occurrences

int characterCount | ( |  | ) | const

Search for all occurrences

void setDefaultStyleSheet | ( | const QString & | sheet | ) |

Search for all occurrences

QString defaultStyleSheet | ( |  | ) | const

Search for all occurrences

void undo | ( | QTextCursor * | cursor | ) |

Search for all occurrences

void redo | ( | QTextCursor * | cursor | ) |

Search for all occurrences

void clearUndoRedoStacks | ( | Stacks | historyToClear = `UndoAndRedoStacks` | ) |

Search for all occurrences

int maximumBlockCount | ( |  | ) | const

Search for all occurrences

void setMaximumBlockCount | ( | int | maximum | ) |

Search for all occurrences

QTextOption defaultTextOption | ( |  | ) | const

Search for all occurrences

void setDefaultTextOption | ( | const QTextOption & | option | ) |

Search for all occurrences

void contentsChange | ( | int | from,
|  | int | charsRemoves,
|  | int | charsAdded
| ) |  | `[signal]`

Search for all occurrences

void contentsChanged | ( |  | ) | `[signal]`

Search for all occurrences

void undoAvailable | ( | bool |  | ) | `[signal]`

Search for all occurrences

void redoAvailable | ( | bool |  | ) | `[signal]`

Search for all occurrences

void undoCommandAdded | ( |  | ) | `[signal]`

Search for all occurrences

void modificationChanged | ( | bool | m | ) | `[signal]`

Search for all occurrences

void cursorPositionChanged | ( | const QTextCursor & | cursor | ) | `[signal]`

Search for all occurrences

void blockCountChanged | ( | int | newBlockCount | ) | `[signal]`

Search for all occurrences

void documentLayoutChanged | ( |  | ) | `[signal]`

Search for all occurrences

void undo | ( |  | ) | `[slot]`

Search for all occurrences

void redo | ( |  | ) | `[slot]`

Search for all occurrences

void appendUndoItem | ( | QAbstractUndoItem * |  | ) | `[slot]`

Search for all occurrences

void setModified | ( | bool | m = `true` | ) | `[slot]`

Search for all occurrences

virtual QTextObject* createObject | ( | const QTextFormat & | f | ) | `[protected, virtual]`

Search for all occurrences

virtual QVariant loadResource | ( | int | type,
|  | const QUrl & | name
| ) |  | `[protected, virtual]`

Search for all occurrences

QTextDocumentPrivate* docHandle | ( |  | ) | const

Search for all occurrences

## Friends And Related Function Documentation

friend class QTextObjectPrivate `[friend]`

Search for all occurrences

Definition at line 300 of file qtextdocument.h.

## Property Documentation

bool undoRedoEnabled `[read, write]`

Search for all occurrences

Definition at line 113 of file qtextdocument.h.

bool modified `[read, write]`

Search for all occurrences

Definition at line 114 of file qtextdocument.h.

QSizeF pageSize `[read, write]`

Search for all occurrences

Definition at line 115 of file qtextdocument.h.

QFont defaultFont `[read, write]`

Search for all occurrences

Definition at line 116 of file qtextdocument.h.

bool useDesignMetrics `[read, write]`

Search for all occurrences

Definition at line 117 of file qtextdocument.h.

QSizeF size `[read]`

Search for all occurrences

Definition at line 118 of file qtextdocument.h.

qreal textWidth `[read, write]`

Search for all occurrences

Definition at line 119 of file qtextdocument.h.

int blockCount `[read]`

Search for all occurrences

Definition at line 120 of file qtextdocument.h.

qreal indentWidth `[read, write]`

Search for all occurrences

Definition at line 121 of file qtextdocument.h.

QString defaultStyleSheet `[read, write]`

Search for all occurrences

Definition at line 123 of file qtextdocument.h.

int maximumBlockCount `[read, write]`

Search for all occurrences

Definition at line 125 of file qtextdocument.h.

qreal documentMargin `[read, write]`

Search for all occurrences

Definition at line 126 of file qtextdocument.h.

The documentation for this class was generated from the following file:

- QtGui/qtextdocument.h

QTextDocument QTextDocument QTextDocument QTextDocument QTextDocument QTextDocument QTextDocument QTextDocument QTextDocument QTextDocument
QTextDocument QTextDocument QTextDocument QTextDocument QTextDocument QTextDocument QTextDocument QTextDocument QTextDocument QTextDocument