QTextObject 类是不同种类对象的基类,可以分组部分 QTextDocument 在一起。 更多...
头: | #include <QTextObject> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
继承: | QObject |
继承者: |
注意: 此类的所有函数 可重入 .
QTextDocument * | document () const |
QTextFormat | format () const |
int | formatIndex () const |
int | objectIndex () const |
QTextObject (QTextDocument * document ) | |
virtual | ~QTextObject () |
void | setFormat (const QTextFormat & format ) |
The common grouping text objects are lists ( QTextList ), frames ( QTextFrame ), and tables ( QTextTable ). A text object has an associated format () 和 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.
[explicit protected]
QTextObject::
QTextObject
(
QTextDocument
*
document
)
Creates a new QTextObject for the given document .
警告: This function should never be called directly, but only from QTextDocument::createObject ().
[virtual noexcept protected]
QTextObject::
~QTextObject
()
销毁文本对象。
警告: Text objects are owned by the document, so you should never destroy them yourself.
Returns the document this object belongs to.
另请参阅 format ().
返回文本对象的格式。
另请参阅 setFormat () 和 document ().
Returns the index of the object's format in the document's internal list of formats.
另请参阅 QTextDocument::allFormats ().
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 ().