このページでは

QTextItem Class

QTextItem クラスは、カスタムペイントエンジンでテキストを描画するために必要なすべての情報を提供します。詳細...

ヘッダー: #include <QTextItem>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
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

詳細な説明

独自のペイントエンジンを再実装する場合は、引数の一つとして QTextItem を受け取る関数である `QPaintEngine::drawTextItem()` を再実装する必要があります。

メンバ型のドキュメント

enum QTextItem::RenderFlag
flags QTextItem::RenderFlags

定数値説明
QTextItem::RightToLeft0x1テキストを右から左へレンダリングします。
QTextItem::Overline0x10テキストの上に線を引きます。
QTextItem::Underline0x20テキストの下に線を引きます。
QTextItem::StrikeOut0x40テキストを横切る線を描画します。

RenderFlags 型は、QFlags<RenderFlag> の typedef です。これは、RenderFlag 値の OR 組み合わせを格納します。

メンバ関数のドキュメント

qreal QTextItem::ascent() const

描画されるテキストの「ascent 」に対応します。

qreal QTextItem::descent() const

描画されるテキストの「descent 」に対応します。

QFont QTextItem::font() const

テキストの描画に使用するフォントを返します。

QTextItem::RenderFlags QTextItem::renderFlags() const

使用されたレンダリングフラグを返します。

QString QTextItem::text() const

描画すべきテキストを返します。

qreal QTextItem::width() const

描画するテキストの合計幅を指定します。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.