このページでは

QTextObject Class

QTextObject クラスは、QTextDocument の各部分をまとめて管理できる、さまざまな種類のオブジェクトの基底クラスです。詳細...

ヘッダー: #include <QTextObject>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
継承元: QObject
継承元:

QTextBlockGroup およびQTextFrame

注:このクラスのすべての関数は再入可能です。

パブリック関数

QTextDocument *document() const
QTextFormat format() const
int formatIndex() const
int objectIndex() const

保護された関数

QTextObject(QTextDocument *document)
virtual ~QTextObject()
void setFormat(const QTextFormat &format)

詳細な説明

一般的なテキストオブジェクトのグループには、リスト (QTextList)、フレーム (QTextFrame)、および表 (QTextTable) があります。テキストオブジェクトには、format() およびdocument() が関連付けられています。

テキストオブジェクトには、基本的に 2 種類あります。ブロック(ブロック書式)で使用されるものと、文字(文字書式)で使用されるものです。前者は `QTextBlockGroup` から派生しており、後者は `QTextFrame` から派生しています。

このクラスを直接使用する必要はほとんどありません。カスタムテキストオブジェクトを作成する際には、テキストオブジェクトを作成するためのファクトリメソッドとして機能する `QTextDocument::createObject()` も再実装する必要があります。

QTextDocumentも参照してください 。

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

[explicit protected] QTextObject::QTextObject(QTextDocument *document)

指定されたdocument に対して、新しいQTextObjectを作成します。

警告: この関数は 決して直接呼び出してはならず、QTextDocument::createObject() からのみ呼び出す必要があります。

[virtual noexcept protected] QTextObject::~QTextObject()

テキストオブジェクトを破棄します。

警告:テキスト オブジェクトはドキュメントが管理しているため、決して自分で破棄してはいけません。

QTextDocument *QTextObject::document() const

このオブジェクトが属するドキュメントを返します。

format()も参照してください 。

QTextFormat QTextObject::format() const

テキストオブジェクトのフォーマットを返します。

setFormat() およびdocument()も参照してください 。

int QTextObject::formatIndex() const

ドキュメントの内部フォーマット一覧における、そのオブジェクトのフォーマットのインデックスを返します。

QTextDocument::allFormats()も参照してください 。

int QTextObject::objectIndex() const

このオブジェクトのオブジェクトインデックスを返します。これは、QTextFormat::setObjectIndex() と組み合わせて使用できます。

[protected] void QTextObject::setFormat(const QTextFormat &format)

テキストオブジェクトのformat を設定します。

format()も参照してください 。

© 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.