QTextObject Class Reference

The QTextObject class is a base class for different kinds of objects that can group parts of a QTextDocument together.

  1. #include <QTextObject>

Inherits: QObject.

Inherited by: QTextBlockGroup and QTextFrame.

Note: All functions in this class are reentrant.

Detailed Description

The QTextObject class is a base class for different kinds of objects that can group parts of a QTextDocument together.

The common grouping text objects are lists (QTextList), frames (QTextFrame), and tables (QTextTable). A text object has an associated format() and document().

There are essentially two kinds of text objects: those that are used with blocks (block formats), and those that are used with characters (character formats). The first kind are derived from QTextBlockGroup, and the second kind from QTextFrame.

You rarely need to use this class directly. When creating custom text objects, you will also need to reimplement QTextDocument::createObject() which acts as a factory method for creating text objects.

See also QTextDocument and Text Object Example.

Public Functions

Toggle details QTextObject

QTextObjectQTextObject ( QTextDocument *document ) ( QTextDocument *document )[protected]

Creates a new QTextObject for the given document.

Warning: This function should never be called directly, but only from QTextDocument::createObject().

Look up this member in the source code.

Toggle details QTextObject

~QTextObject~QTextObject () ()[protected]

Destroys the text object.

Warning: Text objects are owned by the document, so you should never destroy them yourself.

Look up this member in the source code.

Toggle details QTextDocument * QTextObject

documentdocument () ()const

Returns the document this object belongs to.

See also format().

Look up this member in the source code.

Toggle details QTextFormat QTextObject

formatformat () ()const

Returns the text object's format.

See also setFormat() and document().

Look up this member in the source code.

Toggle details int QTextObject

formatIndexformatIndex () ()const

Returns the index of the object's format in the document's internal list of formats.

See also QTextDocument::allFormats().

Look up this member in the source code.

Toggle details int QTextObject

objectIndexobjectIndex () ()const

Returns the object index of this object. This can be used together with QTextFormat::setObjectIndex().

Look up this member in the source code.

Toggle details void QTextObject

setFormatsetFormat ( const QTextFormat &format ) ( const QTextFormat &format )[protected]

Sets the text object's format.

See also format().

Look up this member in the source code.

    Notes provided by the Qt Community

    No notes