PySide6.QtGui.QTextInlineObject¶
- class QTextInlineObject¶
QTextInlineObject
类表示在QAbstractTextDocumentLayout
及其实现中的内联对象。更多…概要¶
方法¶
def
__init__()
def
ascent()
def
descent()
def
format()
def
formatIndex()
def
height()
def
isValid()
def
rect()
def
setAscent()
def
setDescent()
def
setWidth()
def
textDirection()
def
textPosition()
def
width()
注意
本文档可能包含从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:
返回文本布局中内联对象的格式。
- formatIndex()¶
- Return type:
整数
返回一个整数,描述文本布局中内联对象的格式。
- height()¶
- Return type:
浮点数
返回内联对象的总高度。这等于
ascent()
+descent()
+ 1。- isValid()¶
- Return type:
布尔
如果此内联对象有效,则返回
true
;否则返回false。返回内联对象的矩形。
- setAscent(a)¶
- Parameters:
a – 浮点数
将内联对象的上升设置为
a
。- setDescent(d)¶
- Parameters:
d – 浮点数
将内联对象的下降设置为
d
。- setWidth(w)¶
- Parameters:
w – 浮点数
将内联对象的宽度设置为
w
。- textDirection()¶
- Return type:
返回对象是否应从右到左或从左到右布局。
- textPosition()¶
- Return type:
整数
内联对象在文本布局中的位置。
- width()¶
- Return type:
浮点数
返回内联对象的宽度。