PySide6.QtGui.QTextInlineObject

class QTextInlineObject

QTextInlineObject 类表示在 QAbstractTextDocumentLayout 及其实现中的内联对象。更多

概要

方法

注意

本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。

详细描述

通常,您不需要创建一个QTextInlineObject。它由QAbstractTextDocumentLayout在实现自定义布局时用于处理内联对象。

内联对象具有可以设置的各种属性,例如使用 setWidth()setAscent()setDescent()。它占据的矩形由 rect() 给出,其方向由 textDirection() 给出。它在文本布局中的位置由 textPosition() 给出,其格式由 format() 给出。

__init__()
ascent()
Return type:

浮点数

返回内联对象的上升高度。

descent()
Return type:

浮点数

返回内联对象的下降部分。

format()
Return type:

QTextFormat

返回文本布局中内联对象的格式。

formatIndex()
Return type:

整数

返回一个整数,描述文本布局中内联对象的格式。

height()
Return type:

浮点数

返回内联对象的总高度。这等于 ascent() + descent() + 1。

isValid()
Return type:

布尔

如果此内联对象有效,则返回true;否则返回false。

rect()
Return type:

QRectF

返回内联对象的矩形。

另请参阅

ascent() descent() width()

setAscent(a)
Parameters:

a – 浮点数

将内联对象的上升设置为 a

setDescent(d)
Parameters:

d – 浮点数

将内联对象的下降设置为d

setWidth(w)
Parameters:

w – 浮点数

将内联对象的宽度设置为 w

textDirection()
Return type:

LayoutDirection

返回对象是否应从右到左或从左到右布局。

textPosition()
Return type:

整数

内联对象在文本布局中的位置。

width()
Return type:

浮点数

返回内联对象的宽度。