In questa pagina

QTextTableCell Class

La classe QTextTableCell rappresenta le proprietà di una cella in un QTextTable. Per saperne di più...

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

Nota: tutte le funzioni di questa classe sono rientranti.

Funzioni pubbliche

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

Descrizione dettagliata

Le celle di tabella sono elementi della struttura del documento che appartengono a una tabella. La tabella ordina le celle in righe e colonne specifiche; le celle possono anche estendersi su più colonne e righe.

Le celle vengono solitamente create quando una tabella viene inserita in un documento con QTextCursor::insertTable(), ma vengono anche create e distrutte quando una tabella viene ridimensionata.

Le celle contengono informazioni sulla loro posizione all’interno di una tabella; è possibile ottenere i valori di row() e column() di una cella, nonché i valori di rowSpan() e columnSpan().

La funzione format() di una cella descrive il formato predefinito dei caratteri del suo contenuto. Le funzioni firstCursorPosition() e lastCursorPosition() vengono utilizzate per ottenere l'estensione della cella nel documento.

Vedi anche QTextTable e QTextTableFormat.

Documentazione sulle funzioni membro

QTextTableCell::QTextTableCell()

Crea una cella di tabella non valida.

Vedi anche isValid().

QTextTableCell::QTextTableCell(const QTextTableCell &other)

Costruttore di copia. Crea un nuovo oggetto QTextTableCell basato sulla cella other.

[noexcept] QTextTableCell::~QTextTableCell()

Elimina la cella della tabella.

QTextFrame::iterator QTextTableCell::begin() const

Restituisce un iteratore di frame che punta all'inizio della cella della tabella.

Vedi anche end().

int QTextTableCell::column() const

Restituisce il numero della colonna della tabella che contiene questa cella.

Vedi anche row().

int QTextTableCell::columnSpan() const

Restituisce il numero di colonne che questa cella occupa. Il valore predefinito è 1.

Vedi anche rowSpan().

QTextFrame::iterator QTextTableCell::end() const

Restituisce un iteratore di frame che punta alla fine della cella della tabella.

Vedi anche begin().

QTextCursor QTextTableCell::firstCursorPosition() const

Restituisce la prima posizione valida del cursore in questa cella.

Vedi anche lastCursorPosition().

QTextCharFormat QTextTableCell::format() const

Restituisce il formato dei caratteri della cella.

Vedi anche setFormat().

bool QTextTableCell::isValid() const

Restituisce ` true ` se si tratta di una cella della tabella valida; in caso contrario, restituisce `false`.

QTextCursor QTextTableCell::lastCursorPosition() const

Restituisce l'ultima posizione valida del cursore in questa cella.

Vedi anche firstCursorPosition().

int QTextTableCell::row() const

Restituisce il numero della riga della tabella che contiene questa cella.

Vedi anche column().

int QTextTableCell::rowSpan() const

Restituisce il numero di righe che questa cella copre. Il valore predefinito è 1.

Vedi anche columnSpan().

void QTextTableCell::setFormat(const QTextCharFormat &format)

Imposta il formato dei caratteri della cella su “ format ”. Questa funzione può essere utilizzata, ad esempio, per modificare il colore di sfondo dell’intera cella:

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

Si noti che questa funzione non consente di modificare l'estensione della cella lungo le righe o le colonne. A tal fine, è necessario utilizzare invece le funzioni ` QTextTable::mergeCells ` e ` QTextTable::splitCell `.

Vedi anche format().

int QTextTableCell::tableCellFormatIndex() const

Restituisce l'indice del formato della cella della tabella nell'elenco interno dei formati del documento.

Vedi anche QTextDocument::allFormats().

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

Restituisce ` true ` se questo oggetto cella e l'oggetto cella ` other ` descrivono celle diverse; altrimenti restituisce ` false`.

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

Assegna la cella della tabella “ other ” a questa cella della tabella.

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

Restituisce ` true ` se questo oggetto cella e l'oggetto cella ` other ` descrivono la stessa cella; altrimenti restituisce ` 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.