QTextFrame Class

QTextFrameクラスは、QTextDocument のフレームを表します

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

QTextTable

注意:このクラスの関数はすべてリエントラントです。

パブリック型

パブリック関数

QTextFrame(QTextDocument *document)
virtual ~QTextFrame()
QTextFrame::iterator begin() const
QList<QTextFrame *> childFrames() const
QTextFrame::iterator end() const
QTextCursor firstCursorPosition() const
int firstPosition() const
QTextFrameFormat frameFormat() const
QTextCursor lastCursorPosition() const
int lastPosition() const
QTextFrame *parentFrame() const
void setFrameFormat(const QTextFrameFormat &format)

詳細説明

テキストフレームは、ドキュメント内のテキストの構造を提供します。他のドキュメント要素の汎用コンテナとして使用されます。フレームは通常QTextCursor::insertFrame() を使って作成されます。

フレームは、リッチテキスト文書の階層構造を作成するために使用することができます。各文書にはルートフレーム (QTextDocument::rootFrame()) があり、ルートフレームの下にある各フレームには親フレームと子フレームのリスト (空の場合もあります) があります。親フレームはparentFrame() で見つけることができ、childFrames() 関数は子フレームのリストを提供します。

各フレームには少なくとも1つのテキストブロックがあり、テキストカーソルで新しいドキュメント要素を挿入することができます。その結果、QTextFrame::iterator クラスは、与えられたフレーム内のブロックと子フレームの両方を走査するために使用されます。フレーム内の最初と最後の子要素はbegin() とend() で見つけることができます。

フレームにはフォーマット(QTextFrameFormat で指定)もあり、setFormat() で設定し、format() で読み込むことができます。

フレーム内の有効なカーソル位置の最初と最後を指すテキストカーソルを取得することができます。これにはfirstCursorPosition() とlastCursorPosition() 関数を使用します。ドキュメント内のフレームの範囲は、firstPosition() およびlastPosition() で確認できます。

QTextFrame::iterator クラスを使用すると、フレームの内容を反復処理することができます。このクラスは、内部のテキストブロックや子フレームのリストに読み込み専用でアクセスできます。

QTextCursor およびQTextDocumentも参照して ください。

メンバ型ドキュメント

QTextFrame::Iterator

QTextFrame::iterator の Qt 形式のシノニム。

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

[explicit] QTextFrame::QTextFrame(QTextDocument *document)

テキスト用の新しい空のフレームを作成しますdocument

[virtual noexcept] QTextFrame::~QTextFrame()

テキストフレームを破壊する。

警告 テキストフレームはドキュメントの所有物なので、決して自分で破棄してはいけません。ドキュメントからフレームを削除するには、QTextCursor を使ってその内容を削除してください。

QTextFrame::iterator QTextFrame::begin() const

フレーム内の最初のドキュメント要素を指すイテレータを返します。詳しくはSTL-style-Iteratorsを参照してください。

end()も参照してください

QList<QTextFrame *> QTextFrame::childFrames() const

フレームの子フレームの(おそらく空の)リストを返します。

parentFrame()も参照ください

QTextFrame::iterator QTextFrame::end() const

フレーム内の最後のドキュメント要素を過ぎた位置を指すイテレータを返します。詳しくはSTL-Style Iteratorsを参照してください。

begin()も参照してください

QTextCursor QTextFrame::firstCursorPosition() const

フレーム内の最初のカーソル位置を返す。

lastCursorPosition()、firstPosition() およびlastPosition()も参照

int QTextFrame::firstPosition() const

フレーム内の最初のドキュメント位置を返します。

lastPosition()、firstCursorPosition() およびlastCursorPosition()も参照 ください。

QTextFrameFormat QTextFrame::frameFormat() const

フレームのフォーマットを返します。

setFrameFormat()も参照

QTextCursor QTextFrame::lastCursorPosition() const

フレーム内の最後のカーソル位置を返す。

firstCursorPosition()、firstPosition() およびlastPosition()も参照

int QTextFrame::lastPosition() const

フレーム内の最後のドキュメント位置を返します。

firstPosition()、firstCursorPosition() およびlastCursorPosition()も参照

QTextFrame *QTextFrame::parentFrame() const

フレームの親フレームを返します。フレームがドキュメントのルートフレームである場合、これは 0 を返します。

childFrames() およびQTextDocument::rootFrame()も参照 ください。

void QTextFrame::setFrameFormat(const QTextFrameFormat &format)

フレームのformat を設定する。

frameFormat()も参照

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