QTextInlineObject#

The QTextInlineObject class represents an inline object in a QAbstractTextDocumentLayout and its implementations. More

Synopsis#

Functions#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

Normally, you do not need to create a QTextInlineObject . It is used by QAbstractTextDocumentLayout to handle inline objects when implementing a custom layout.

The inline object has various attributes that can be set, for example using, setWidth() , setAscent() , and setDescent() . The rectangle it occupies is given by rect() , and its direction by textDirection() . Its position in the text layout is given by textPosition() , and its format is given by format() .

class PySide6.QtGui.QTextInlineObject#
PySide6.QtGui.QTextInlineObject.ascent()#
Return type:

float

Returns the inline object’s ascent.

PySide6.QtGui.QTextInlineObject.descent()#
Return type:

float

Returns the inline object’s descent.

PySide6.QtGui.QTextInlineObject.format()#
Return type:

PySide6.QtGui.QTextFormat

Returns format of the inline object within the text layout.

PySide6.QtGui.QTextInlineObject.formatIndex()#
Return type:

int

Returns an integer describing the format of the inline object within the text layout.

PySide6.QtGui.QTextInlineObject.height()#
Return type:

float

Returns the inline object’s total height. This is equal to ascent() + descent() + 1.

PySide6.QtGui.QTextInlineObject.isValid()#
Return type:

bool

Returns true if this inline object is valid; otherwise returns false.

PySide6.QtGui.QTextInlineObject.rect()#
Return type:

PySide6.QtCore.QRectF

Returns the inline object’s rectangle.

PySide6.QtGui.QTextInlineObject.setAscent(a)#
Parameters:

a – float

Sets the inline object’s ascent to a.

PySide6.QtGui.QTextInlineObject.setDescent(d)#
Parameters:

d – float

Sets the inline object’s descent to d.

PySide6.QtGui.QTextInlineObject.setWidth(w)#
Parameters:

w – float

Sets the inline object’s width to w.

PySide6.QtGui.QTextInlineObject.textDirection()#
Return type:

LayoutDirection

Returns if the object should be laid out right-to-left or left-to-right.

PySide6.QtGui.QTextInlineObject.textPosition()#
Return type:

int

The position of the inline object within the text layout.

PySide6.QtGui.QTextInlineObject.width()#
Return type:

float

Returns the inline object’s width.