QTextInlineObject Class
QTextInlineObject 类表示QAbstractTextDocumentLayout 及其实现中的内联对象。更多内容...
| 头文件: | #include <QTextInlineObject> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
| qmake: | QT += gui |
- 所有成员的列表,包括继承的成员
- QTextInlineObject 是富文本处理 API 的一部分。
注意:该类中的所有函数均为可重入函数。
公共函数
| qreal | ascent() const |
| qreal | descent() const |
| QTextFormat | format() const |
| int | formatIndex() const |
| qreal | height() const |
| bool | isValid() const |
| QRectF | rect() const |
| void | setAscent(qreal a) |
| void | setDescent(qreal d) |
| void | setWidth(qreal w) |
| Qt::LayoutDirection | textDirection() const |
| int | textPosition() const |
| qreal | width() const |
详细说明
通常,您无需创建 QTextInlineObject。QAbstractTextDocumentLayout 在实现自定义布局时会使用它来处理内联对象。
内联对象具有多种可设置的属性,例如使用setWidth()、setAscent() 和setDescent()。它所占用的矩形由rect() 指定,其方向由textDirection() 指定。它在文本布局中的位置由textPosition() 指定,其格式由format() 指定。
成员函数文档
qreal QTextInlineObject::ascent() const
返回内联对象的上升值。
另请参阅 setAscent()、descent()、width() 和rect()。
qreal QTextInlineObject::descent() const
返回内联对象的派生关系。
另请参阅 setDescent()、ascent()、width() 以及rect()。
QTextFormat QTextInlineObject::format() const
返回文本布局中内联对象的格式。
int QTextInlineObject::formatIndex() const
返回一个整数,用于描述文本布局中内联对象的格式。
qreal QTextInlineObject::height() const
返回内联对象的总高度。该值等于ascent() +descent() + 1。
另请参阅 ascent()、descent()、width() 以及rect()。
bool QTextInlineObject::isValid() const
如果此内联对象有效,则返回true ;否则返回false。
QRectF QTextInlineObject::rect() const
返回内联对象的矩形。
另请参阅 ascent()、descent() 和width()。
void QTextInlineObject::setAscent(qreal a)
将内联对象的上升量设置为a 。
另请参阅 ascent()、setDescent()、width() 和rect()。
void QTextInlineObject::setDescent(qreal d)
将内联对象的下降量设置为d 。
另请参阅 descent()、setAscent()、width() 和rect()。
void QTextInlineObject::setWidth(qreal w)
将内联对象的宽度设置为w 。
另请参阅 width()、ascent()、descent() 和rect()。
Qt::LayoutDirection QTextInlineObject::textDirection() const
返回该对象应采用从右到左还是从左到右的排版方式。
int QTextInlineObject::textPosition() const
行内对象在文本布局中的位置。
qreal QTextInlineObject::width() const
返回内联对象的宽度。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.