|  | Home · Overviews · Examples

# QTextFormat Class Reference
[com.trolltech.qt.gui module]

The `QTextFormat` class provides formatting information for a `QTextDocument`. More...

Inherited by `QTextBlockFormat`, `QTextCharFormat`, `QTextFrameFormat`, and `QTextListFormat`.

## Detailed Description

The `QTextFormat` class provides formatting information for a `QTextDocument`.

A `QTextFormat` is a generic class used for describing the format of parts of a `QTextDocument`. The derived classes `QTextCharFormat`, `QTextBlockFormat`, `QTextListFormat`, and `QTextTableFormat` are usually more useful, and describe the formatting that is applied to specific parts of the document.

A format has a `FormatType` which specifies the kinds of thing it can format; e.g. a block of text, a list, a table, etc. A format also has various properties (some specific to particular format types), as described by the Property enum. Every property has a corresponding Property.

The format type is given by `type`, and the format can be tested with `isCharFormat`, `isBlockFormat`, `isListFormat`, `isTableFormat`, `isFrameFormat`, and `isImageFormat`. If the type is determined, it can be retrieved with `toCharFormat`, `toBlockFormat`, `toListFormat`, `toTableFormat`, `toFrameFormat`, and `toImageFormat`.

A format's properties can be set with the `setProperty` functions, and retrieved with `boolProperty`, `intProperty`, `doubleProperty`, and `stringProperty` as appropriate. All the property IDs used in the format can be retrieved with allPropertyIds(). One format can be merged into another using `merge`.

A format's object index can be set with `setObjectIndex`, and retrieved with `objectIndex`. These methods can be used to associate the format with a `QTextObject`. It is used to represent lists, frames, and tables inside the document.

See also Text Processing Classes.