このページでは

QTextTableCell Class

QTextTableCell クラスは、QTextTable 内のセルのプロパティを表します。詳細...

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

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

パブリック関数

QTextTableCell()
QTextTableCell(const QTextTableCell &other)
~QTextTableCell()
QTextFrame::iterator begin() const
int column() const
int columnSpan() const
QTextFrame::iterator end() const
QTextCursor firstCursorPosition() const
QTextCharFormat format() const
bool isValid() const
QTextCursor lastCursorPosition() const
int row() const
int rowSpan() const
void setFormat(const QTextCharFormat &format)
int tableCellFormatIndex() const
bool operator!=(const QTextTableCell &other) const
QTextTableCell &operator=(const QTextTableCell &other)
bool operator==(const QTextTableCell &other) const

詳細な説明

テーブルセルは、テーブルに属するドキュメント構造の一部です。テーブルは、セルを特定の行と列に並べ替えます。また、セルは複数の列や行にまたがることもあります。

セルは通常、QTextCursor::insertTable() を使用してテーブルがドキュメントに挿入される際に作成されますが、テーブルのサイズ変更時にも作成および破棄されます。

セルには、テーブル内での位置に関する情報が含まれています。セルのrow() およびcolumn() の数値、ならびにrowSpan() およびcolumnSpan() を取得することができます。

セルのformat()は、その内容に対するデフォルトの文字書式を記述します。firstCursorPosition()およびlastCursorPosition()関数は、ドキュメント内でのセルの範囲を取得するために使用されます。

「 QTextTable 」および「QTextTableFormat 」も参照してください 。

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

QTextTableCell::QTextTableCell()

無効なテーブルセルを作成します。

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

QTextTableCell::QTextTableCell(const QTextTableCell &other)

コピーコンストラクタ。other セルに基づいて、新しいQTextTableCellオブジェクトを作成します。

[noexcept] QTextTableCell::~QTextTableCell()

テーブルのセルを削除します。

QTextFrame::iterator QTextTableCell::begin() const

テーブルのセルの先頭を指すフレームイテレータを返します。

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

int QTextTableCell::column() const

このセルが含まれるテーブル内の列番号を返します。

「row()」も参照してください 。

int QTextTableCell::columnSpan() const

このセルが占める列の数を返します。デフォルトは 1 です。

「rowSpan()」も参照してください 。

QTextFrame::iterator QTextTableCell::end() const

テーブルのセルの末尾を指すフレームイテレータを返します。

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

QTextCursor QTextTableCell::firstCursorPosition() const

このセル内の最初の有効なカーソル位置を返します。

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

QTextCharFormat QTextTableCell::format() const

セルの文字形式を返します。

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

bool QTextTableCell::isValid() const

これが有効なテーブルセルである場合は `true ` を返し、そうでない場合は `false` を返します。

QTextCursor QTextTableCell::lastCursorPosition() const

このセル内の最後の有効なカーソル位置を返します。

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

int QTextTableCell::row() const

このセルが含まれるテーブル内の行番号を返します。

「column()」も参照してください 。

int QTextTableCell::rowSpan() const

このセルが占める行数を返します。デフォルトは 1 です。

「columnSpan()」も参照してください 。

void QTextTableCell::setFormat(const QTextCharFormat &format)

セルの文字書式を「format 」に設定します。これは、例えばセル全体の背景色を変更する際に使用できます。

QTextTableCell cell = table->cellAt(2, 3);
QTextCharFormat format = cell.format();
format.setBackground(Qt::blue);
cell.setFormat(format);

なお、この関数ではセルの行または列の範囲を変更することはできません。その場合は、代わりに `QTextTable::mergeCells ` および `QTextTable::splitCell ` を使用する必要があります。

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

int QTextTableCell::tableCellFormatIndex() const

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

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

bool QTextTableCell::operator!=(const QTextTableCell &other) const

このセルオブジェクトと、other のセルオブジェクトが異なるセルを表している場合はtrue を返し、そうでない場合はfalse を返します。

QTextTableCell &QTextTableCell::operator=(const QTextTableCell &other)

other テーブルのセルを、このテーブルのセルに割り当てます。

bool QTextTableCell::operator==(const QTextTableCell &other) const

このセルオブジェクトとother のセルオブジェクトが同じセルを表している場合はtrue を返し、そうでない場合はfalse を返します。

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