![]() |
Qt 6.x
The Qt SDK
|
\reentrant More...
#include <qtexttable.h>
Public Member Functions | |
QTextTableCell () | |
Constructs an invalid table cell. | |
~QTextTableCell () | |
Destroys the table cell. | |
QTextTableCell (const QTextTableCell &o) | |
Copy constructor. | |
QTextTableCell & | operator= (const QTextTableCell &o) |
Assigns the other table cell to this table cell. | |
void | setFormat (const QTextCharFormat &format) |
QTextCharFormat | format () const |
Returns the cell's character format. | |
int | row () const |
Returns the number of the row in the table that contains this cell. | |
int | column () const |
Returns the number of the column in the table that contains this cell. | |
int | rowSpan () const |
Returns the number of rows this cell spans. | |
int | columnSpan () const |
Returns the number of columns this cell spans. | |
bool | isValid () const |
Returns true if this is a valid table cell; otherwise returns false. | |
QTextCursor | firstCursorPosition () const |
Returns the first valid cursor position in this cell. | |
QTextCursor | lastCursorPosition () const |
Returns the last valid cursor position in this cell. | |
int | firstPosition () const |
int | lastPosition () const |
bool | operator== (const QTextTableCell &other) const |
Returns true if this cell object and the other cell object describe the same cell; otherwise returns false . | |
bool | operator!= (const QTextTableCell &other) const |
Returns true if this cell object and the other cell object describe different cells; otherwise returns false . | |
QTextFrame::iterator | begin () const |
Returns a frame iterator pointing to the beginning of the table's cell. | |
QTextFrame::iterator | end () const |
Returns a frame iterator pointing to the end of the table's cell. | |
int | tableCellFormatIndex () const |
Friends | |
class | QTextTable |
\reentrant
The QTextTableCell class represents the properties of a cell in a QTextTable. \inmodule QtGui
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.
Definition at line 18 of file qtexttable.h.
|
inline |
|
inline |
Destroys the table cell.
Definition at line 22 of file qtexttable.h.
|
inline |
Copy constructor.
Creates a new QTextTableCell object based on the other cell.
Definition at line 23 of file qtexttable.h.
QTextFrame::iterator QTextTableCell::begin | ( | ) | const |
Returns a frame iterator pointing to the beginning of the table's cell.
Definition at line 245 of file qtexttable.cpp.
References e, firstPosition(), QTextDocumentPrivate::get(), and lastPosition().
Referenced by QTextDocumentLayoutPrivate::drawTableCell(), QTextDocumentLayoutPrivate::hitTest(), QTextDocumentLayoutPrivate::layoutCell(), QTextDocumentLayoutPrivate::layoutTable(), MainWindow::showTable(), and QTextMarkdownWriter::writeFrame().
int QTextTableCell::column | ( | ) | const |
Returns the number of the column in the table that contains this cell.
Definition at line 149 of file qtexttable.cpp.
References QList< T >::at(), QTextTablePrivate::cellIndices, QTextTablePrivate::dirty, QTextTablePrivate::findCellIndex(), QTextTablePrivate::nCols, and QTextTablePrivate::update().
Referenced by QTextCursorPrivate::aboutToRemoveCell(), adjacentCell(), cellEdgeData(), QTextTableData::cellPosition(), QTextTableData::cellRect(), QTextCopyHelper::copy(), drawCellBorder(), QTextDocumentLayoutPrivate::drawTableCell(), QWidgetTextControlPrivate::gotoNextTableCell(), QWidgetTextControlPrivate::gotoPreviousTableCell(), QTextDocumentLayoutPrivate::hitTest(), QTextDocumentLayoutPrivate::layoutCell(), QTextDocumentLayoutPrivate::layoutTable(), QTextTable::mergeCells(), QTextCursorPrivate::movePosition(), QTextCursorPrivate::selectedTableCells(), QTextCursor::selectedText(), QTextCursorPrivate::setBlockCharFormat(), QTextCursorPrivate::setBlockFormat(), QTextCursorPrivate::setCharFormat(), sharesAxis(), QTextTable::splitCell(), and QTextMarkdownWriter::writeFrame().
int QTextTableCell::columnSpan | ( | ) | const |
Returns the number of columns this cell spans.
The default is 1.
Definition at line 176 of file qtexttable.cpp.
References format(), and QTextCharFormat::tableCellColumnSpan().
Referenced by adjacentCell(), cellEdgeData(), QTextTableData::cellRect(), QTextCopyHelper::copy(), QTextDocumentLayoutPrivate::drawTableCell(), QWidgetTextControlPrivate::gotoNextTableCell(), QTextDocumentLayoutPrivate::layoutTable(), QTextCursorPrivate::movePosition(), QTextCursorPrivate::selectedTableCells(), QTextCursor::selectedText(), QTextCursorPrivate::setBlockCharFormat(), QTextCursorPrivate::setBlockFormat(), QTextCursorPrivate::setCharFormat(), sharesAxis(), QTextMarkdownWriter::writeFrame(), and QTextOdfWriter::writeFrame().
QTextFrame::iterator QTextTableCell::end | ( | ) | const |
Returns a frame iterator pointing to the end of the table's cell.
Definition at line 258 of file qtexttable.cpp.
References e, firstPosition(), QTextDocumentPrivate::get(), and lastPosition().
Referenced by QTextMarkdownWriter::writeFrame().
QTextCursor QTextTableCell::firstCursorPosition | ( | ) | const |
Returns the first valid cursor position in this cell.
Definition at line 194 of file qtexttable.cpp.
References firstPosition(), and QTextCursorPrivate::fromPosition().
Referenced by QTextMarkdownImporter::cbEnterBlock(), QWidgetTextControlPrivate::gotoNextTableCell(), QWidgetTextControlPrivate::gotoPreviousTableCell(), and QTextTable::mergeCells().
int QTextTableCell::firstPosition | ( | ) | const |
Returns the first valid position in the document occupied by this cell.
Definition at line 215 of file qtexttable.cpp.
References QTextDocumentPrivate::get().
Referenced by QTextCursorPrivate::aboutToRemoveCell(), adjustContextSelectionsForCell(), QTextCursorPrivate::adjustCursor(), begin(), QTextCursorPrivate::clearCells(), QTextCopyHelper::copy(), end(), firstCursorPosition(), QTextDocumentLayoutPrivate::hitTest(), QTextTable::mergeCells(), QTextCursorPrivate::movePosition(), QTextCursor::selectedText(), QTextCursorPrivate::setBlockCharFormat(), QTextCursorPrivate::setBlockFormat(), QTextCursorPrivate::setCharFormat(), and QTextTable::splitCell().
QTextCharFormat QTextTableCell::format | ( | ) | const |
Returns the cell's character format.
Definition at line 104 of file qtexttable.cpp.
References fmt, QTextDocumentPrivate::get(), tableCellFormatIndex(), and QTextFormat::TableCellObject.
Referenced by QTextTableData::bottomPadding(), cellEdgeData(), columnSpan(), QTextCopyHelper::copy(), drawCellBorder(), QTextDocumentLayoutPrivate::drawTableCell(), QTextDocumentLayoutPrivate::layoutCell(), QTextDocumentLayoutPrivate::layoutTable(), QTextTableData::leftPadding(), QTextTable::mergeCells(), QTextTableData::rightPadding(), rowSpan(), setFormat(), QTextTable::splitCell(), QTextTableData::topPadding(), and QTextOdfWriter::writeFrame().
|
inline |
Returns true
if this is a valid table cell; otherwise returns false.
Definition at line 36 of file qtexttable.h.
Referenced by QTextCursorPrivate::aboutToRemoveCell(), axisEdgeData(), QTextDocumentLayout::blockBoundingRect(), QTextMarkdownImporter::cbEnterBlock(), cellEdgeData(), QTextCursorPrivate::complexSelectionTable(), QTextDocumentLayoutPrivate::frameBoundingRectInternal(), QTextDocumentLayoutPrivate::hitTest(), QTextTable::mergeCells(), QTextCursorPrivate::movePosition(), prioritizedEdgeAnchorOffset(), QTextTable::rowEnd(), QTextTable::rowStart(), QTextCursorPrivate::selectedTableCells(), QTextTable::splitCell(), QTextDocumentLayout::tableBoundingRect(), and QTextDocumentLayout::tableCellBoundingRect().
QTextCursor QTextTableCell::lastCursorPosition | ( | ) | const |
Returns the last valid cursor position in this cell.
Definition at line 204 of file qtexttable.cpp.
References QTextCursorPrivate::fromPosition(), and lastPosition().
int QTextTableCell::lastPosition | ( | ) | const |
Returns the last valid position in the document occupied by this cell.
Definition at line 226 of file qtexttable.cpp.
References QTextTablePrivate::cells, QTextTablePrivate::findCellIndex(), QTextFramePrivate::fragment_end, QTextDocumentPrivate::get(), and QList< T >::value().
Referenced by adjustContextSelectionsForCell(), QTextCursorPrivate::adjustCursor(), begin(), QTextCursorPrivate::clearCells(), QTextCopyHelper::copy(), end(), QTextDocumentLayoutPrivate::hitTest(), lastCursorPosition(), QTextCursorPrivate::movePosition(), QTextTable::removeColumns(), QTextTable::removeRows(), QTextCursor::selectedText(), QTextCursorPrivate::setBlockCharFormat(), QTextCursorPrivate::setBlockFormat(), QTextCursorPrivate::setCharFormat(), and QTextTable::splitCell().
|
inline |
Returns true
if this cell object and the other cell object describe different cells; otherwise returns false
.
Definition at line 45 of file qtexttable.h.
References operator==(), and other().
|
inline |
Assigns the other table cell to this table cell.
Definition at line 24 of file qtexttable.h.
References o.
|
inline |
Returns true
if this cell object and the other cell object describe the same cell; otherwise returns false
.
Definition at line 43 of file qtexttable.h.
References other().
int QTextTableCell::row | ( | ) | const |
Returns the number of the row in the table that contains this cell.
Definition at line 132 of file qtexttable.cpp.
References QList< T >::at(), QTextTablePrivate::cellIndices, QTextTablePrivate::dirty, QTextTablePrivate::findCellIndex(), QTextTablePrivate::nCols, and QTextTablePrivate::update().
Referenced by QTextCursorPrivate::aboutToRemoveCell(), adjacentCell(), cellEdgeData(), QTextTableData::cellPosition(), QTextTableData::cellRect(), QTextCopyHelper::copy(), QTextDocumentLayoutPrivate::drawFrame(), QTextDocumentLayoutPrivate::drawTableCell(), QTextDocumentLayoutPrivate::drawTableCellBorder(), QWidgetTextControlPrivate::gotoNextTableCell(), QWidgetTextControlPrivate::gotoPreviousTableCell(), QTextDocumentLayoutPrivate::hitTest(), QTextDocumentLayoutPrivate::layoutCell(), QTextDocumentLayoutPrivate::layoutTable(), QTextTable::mergeCells(), QTextCursorPrivate::movePosition(), QTextTable::rowEnd(), QTextTable::rowStart(), QTextCursorPrivate::selectedTableCells(), QTextCursor::selectedText(), QTextCursorPrivate::setBlockCharFormat(), QTextCursorPrivate::setBlockFormat(), QTextCursorPrivate::setCharFormat(), sharesAxis(), QTextTable::splitCell(), QTextMarkdownWriter::writeFrame(), and QTextOdfWriter::writeFrame().
int QTextTableCell::rowSpan | ( | ) | const |
Returns the number of rows this cell spans.
The default is 1.
Definition at line 166 of file qtexttable.cpp.
References format(), and QTextCharFormat::tableCellRowSpan().
Referenced by adjacentCell(), cellEdgeData(), QTextTableData::cellRect(), QTextCopyHelper::copy(), QTextDocumentLayoutPrivate::drawTableCell(), QTextDocumentLayoutPrivate::drawTableCellBorder(), QTextDocumentLayoutPrivate::layoutTable(), QTextCursorPrivate::movePosition(), QTextCursorPrivate::selectedTableCells(), QTextCursor::selectedText(), QTextCursorPrivate::setBlockCharFormat(), QTextCursorPrivate::setBlockFormat(), QTextCursorPrivate::setCharFormat(), sharesAxis(), and QTextOdfWriter::writeFrame().
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.
Definition at line 85 of file qtexttable.cpp.
References fmt, format(), QTextDocumentPrivate::get(), QTextFormat::ObjectIndex, QTextDocumentPrivate::SetFormatAndPreserveObjectIndices, QTextCharFormat::tableCellColumnSpan(), QTextFormat::TableCellObject, and QTextCharFormat::tableCellRowSpan().
int QTextTableCell::tableCellFormatIndex | ( | ) | const |
Returns the index of the tableCell's format in the document's internal list of formats.
Definition at line 121 of file qtexttable.cpp.
References QTextDocumentPrivate::get().
Referenced by format(), and QTextOdfWriter::writeFrame().
|
friend |
Definition at line 54 of file qtexttable.h.