class QTextItem

The QTextItem class provides all the information required to draw text in a custom paint engine. 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

When you reimplement your own paint engine, you must reimplement drawTextItem() , a function that takes a QTextItem as one of its arguments.

class RenderFlag

Constant

Description

QTextItem.RightToLeft

(inherits enum.Flag) Render the text from right to left.

QTextItem.Overline

Paint a line above the text.

QTextItem.Underline

Paint a line under the text.

QTextItem.StrikeOut

Paint a line through the text.

ascent()
Return type:

float

Corresponds to the ascent of the piece of text that is drawn.

descent()
Return type:

float

Corresponds to the descent of the piece of text that is drawn.

font()
Return type:

QFont

Returns the font that should be used to draw the text.

renderFlags()
Return type:

Combination of RenderFlag

Returns the render flags used.

text()
Return type:

str

Returns the text that should be drawn.

width()
Return type:

float

Specifies the total width of the text to be drawn.