QTextTableCell Class▲
-
Header: QTextTableCell
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
-
qmake: QT += gui
-
Group: QTextTableCell is part of Rich Text Processing APIs
Detailed Description▲
Table cells are pieces of document structure that belong to a table. The table orders cells into particular rows and columns; cells can also span multiple columns and rows.
Cells are usually created when a table is inserted into a document with QTextCursor::insertTable(), but they are also created and destroyed when a table is resized.
Cells contain information about their location in a table; you can obtain the row() and column() numbers of a cell, and its rowSpan() and columnSpan().
The format() of a cell describes the default character format of its contents. The firstCursorPosition() and lastCursorPosition() functions are used to obtain the extent of the cell in the document.
See Also▲
See also QTextTable, QTextTableFormat
Member Function Documentation▲
QTextTableCell::QTextTableCell()▲
QTextTableCell::QTextTableCell(const QTextTableCell &other)▲
Copy constructor. Creates a new QTextTableCell object based on the other cell.
QTextTableCell::~QTextTableCell()▲
Destroys the table cell.
QTextFrame::iterator QTextTableCell::begin() const▲
int QTextTableCell::column() const▲
int QTextTableCell::columnSpan() const▲
QTextFrame::iterator QTextTableCell::end() const▲
QTextCursor QTextTableCell::firstCursorPosition() const▲
QTextCharFormat QTextTableCell::format() const▲
bool QTextTableCell::isValid() const▲
Returns true if this is a valid table cell; otherwise returns false.
QTextCursor QTextTableCell::lastCursorPosition() const▲
int QTextTableCell::row() const▲
int QTextTableCell::rowSpan() const▲
void QTextTableCell::setFormat(const QTextCharFormat &format)▲
Sets the cell's character format to format. This can for example be used to change the background color of the entire cell:
QTextTableCell cell = table->cellAt(2, 3); QTextCharFormat format = cell.format(); format.setBackground(Qt::blue); cell.setFormat(format);
Note that the cell's row or column span cannot be changed through this function. You have to use QTextTable::mergeCells and QTextTable::splitCell instead.
See Also▲
See also format()
int QTextTableCell::tableCellFormatIndex() const▲
Returns the index of the tableCell's format in the document's internal list of formats.
See Also▲
See also QTextDocument::allFormats()
bool QTextTableCell::operator!=(const QTextTableCell &other) const▲
Returns true if this cell object and the other cell object describe different cells; otherwise returns false.
QTextTableCell &QTextTableCell::operator=(const QTextTableCell &other)▲
Assigns the other table cell to this table cell.
bool QTextTableCell::operator==(const QTextTableCell &other) const▲
Returns true if this cell object and the other cell object describe the same cell; otherwise returns false.