QTextItem 类

The QTextItem class provides all the information required to draw text in a custom paint engine. 更多...

头: #include <QTextItem>
qmake: QT += gui

公共类型

enum RenderFlag { RightToLeft, Overline, Underline, StrikeOut }
flags RenderFlags

公共函数

qreal ascent () const
qreal descent () const
QFont font () const
QTextItem::RenderFlags renderFlags () const
QString text () const
qreal width () const

详细描述

The QTextItem class provides all the information required to draw text in a custom paint engine.

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

成员类型文档编制

enum QTextItem:: RenderFlag
flags QTextItem:: RenderFlags

常量 描述
QTextItem::RightToLeft 0x1 Render the text from right to left.
QTextItem::Overline 0x10 Paint a line above the text.
QTextItem::Underline 0x20 Paint a line under the text.
QTextItem::StrikeOut 0x40 Paint a line through the text.

RenderFlags 类型是 typedef 对于 QFlags <RenderFlag>。它存储 RenderFlag 值的 OR 组合。

成员函数文档编制

qreal QTextItem:: ascent () const

相当于 ascent of the piece of text that is drawn.

qreal QTextItem:: descent () const

相当于 descent of the piece of text that is drawn.

QFont QTextItem:: font () const

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

QTextItem::RenderFlags QTextItem:: renderFlags () const

Returns the render flags used.

QString QTextItem:: text () const

Returns the text that should be drawn.

qreal QTextItem:: width () const

Specifies the total width of the text to be drawn.