Nesta página

QTextTableCell Class

A classe QTextTableCell representa as propriedades de uma célula em uma tabela de texto ( QTextTable). Mais...

Cabeçalho: #include <QTextTableCell>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui

Observação: Todas as funções desta classe são reentrantes.

Funções públicas

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

Descrição detalhada

As células de tabela são partes da estrutura do documento que pertencem a uma tabela. A tabela organiza as células em linhas e colunas específicas; as células também podem abranger várias colunas e linhas.

As células são geralmente criadas quando uma tabela é inserida em um documento com ` QTextCursor::insertTable()`; no entanto, elas também são criadas e destruídas quando uma tabela é redimensionada.

As células contêm informações sobre sua localização na tabela; é possível obter os números de row() e column() de uma célula, bem como seus valores de rowSpan() e columnSpan().

A função format() de uma célula descreve o formato padrão de caracteres de seu conteúdo. As funções firstCursorPosition() e lastCursorPosition() são usadas para obter a extensão da célula no documento.

Veja também QTextTable e QTextTableFormat.

Documentação das funções-membro

QTextTableCell::QTextTableCell()

Cria uma célula de tabela inválida.

Veja também isValid().

QTextTableCell::QTextTableCell(const QTextTableCell &other)

Construtor de cópia. Cria um novo objeto `QTextTableCell` com base na célula ` other `.

[noexcept] QTextTableCell::~QTextTableCell()

Exclui a célula da tabela.

QTextFrame::iterator QTextTableCell::begin() const

Retorna um iterador de quadro que aponta para o início da célula da tabela.

Veja também ` end()`.

int QTextTableCell::column() const

Retorna o número da coluna da tabela que contém essa célula.

Veja também row().

int QTextTableCell::columnSpan() const

Retorna o número de colunas que esta célula ocupa. O valor padrão é 1.

Veja também rowSpan().

QTextFrame::iterator QTextTableCell::end() const

Retorna um iterador de quadro que aponta para o final da célula da tabela.

Veja também ` begin()`.

QTextCursor QTextTableCell::firstCursorPosition() const

Retorna a primeira posição válida do cursor nesta célula.

Veja também lastCursorPosition().

QTextCharFormat QTextTableCell::format() const

Retorna o formato de caracteres da célula.

Veja também setFormat().

bool QTextTableCell::isValid() const

Retorna ` true ` se esta for uma célula válida da tabela; caso contrário, retorna `false`.

QTextCursor QTextTableCell::lastCursorPosition() const

Retorna a última posição válida do cursor nesta célula.

Veja também firstCursorPosition().

int QTextTableCell::row() const

Retorna o número da linha da tabela que contém essa célula.

Veja também column().

int QTextTableCell::rowSpan() const

Retorna o número de linhas que esta célula ocupa. O valor padrão é 1.

Veja também columnSpan().

void QTextTableCell::setFormat(const QTextCharFormat &format)

Define o formato de caracteres da célula como format. Isso pode ser usado, por exemplo, para alterar a cor de fundo de toda a célula:

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

Observe que a extensão da célula (linha ou coluna) não pode ser alterada por meio desta função. Em vez disso, é necessário usar QTextTable::mergeCells e QTextTable::splitCell.

Veja também ` format()`.

int QTextTableCell::tableCellFormatIndex() const

Retorna o índice do formato da tableCell na lista interna de formatos do documento.

Veja também ` QTextDocument::allFormats()`.

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

Retorna ` true ` se este objeto de célula e o objeto de célula ` other ` corresponderem a células diferentes; caso contrário, retorna ` false`.

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

Atribui a célula da tabela “ other ” a esta célula da tabela.

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

Retorna ` true ` se este objeto de célula e o objeto de célula ` other ` se referirem à mesma célula; caso contrário, retorna ` 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.