QTextObject Class

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

头文件: #include <QTextObject>
qmake: QT += gui
基类: QObject
派生类:

QTextBlockGroup and QTextFrame

Note: All functions in this class are reentrant.

公有函数

QTextDocument *document() const
QTextFormat format() const
int formatIndex() const
int objectIndex() const
  • 32 个公有函数继承自 QObject

受保护的函数

QTextObject(QTextDocument *document)
~QTextObject()
void setFormat(const QTextFormat &format)
  • 9 个受保护的函数继承自 QObject

其他继承的成员

  • 1 个属性继承自 QObject
  • 1 个公有槽函数继承自 QObject
  • 2 个信号继承自 QObject
  • 1 个公有变量继承自 QObject
  • 10 个静态公有成员继承自 QObject
  • 2 个受保护的变量继承自 QObject

详细描述

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.

参见 QTextDocument and Text Object Example.

成员函数

[protected] QTextObject::QTextObject(QTextDocument *document)

Creates a new QTextObject for the given document.

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

[protected] QTextObject::~QTextObject()

Destroys the text object.

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

QTextDocument *QTextObject::document() const

Returns the document this object belongs to.

参见 format().

QTextFormat QTextObject::format() const

Returns the text object's format.

参见 setFormat() and document().

int QTextObject::formatIndex() const

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

参见 QTextDocument::allFormats().

int QTextObject::objectIndex() const

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

[protected] void QTextObject::setFormat(const QTextFormat &format)

Sets the text object's format.

参见 format().