PySide6.QtGui.QTextInlineObject

class QTextInlineObject

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

Synopsis

Methods

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() .

__init__()
ascent()
Return type:

float

Returns the inline object’s ascent.

descent()
Return type:

float

Returns the inline object’s descent.

format()
Return type:

QTextFormat

Returns format of the inline object within the text layout.

formatIndex()
Return type:

int

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

height()
Return type:

float

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

isValid()
Return type:

bool

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

rect()
Return type:

QRectF

Returns the inline object’s rectangle.

setAscent(a)
Parameters:

a – float

Sets the inline object’s ascent to a.

setDescent(d)
Parameters:

d – float

Sets the inline object’s descent to d.

setWidth(w)
Parameters:

w – float

Sets the inline object’s width to w.

textDirection()
Return type:

LayoutDirection

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

textPosition()
Return type:

int

The position of the inline object within the text layout.

width()
Return type:

float

Returns the inline object’s width.