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 |
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 () 和 column () numbers of a cell, and its rowSpan () 和 columnSpan ().
The format () of a cell describes the default character format of its contents. The firstCursorPosition () 和 lastCursorPosition () functions are used to obtain the extent of the cell in the document.
另请参阅 QTextTable and QTextTableFormat .
Constructs an invalid table cell.
另请参阅 isValid ().
Copy constructor. Creates a new QTextTableCell object based on the other cell.
[noexcept]
QTextTableCell::
~QTextTableCell
()
Destroys the table cell.
Returns a frame iterator pointing to the beginning of the table's cell.
另请参阅 end ().
Returns the number of the column in the table that contains this cell.
另请参阅 row ().
Returns the number of columns this cell spans. The default is 1.
另请参阅 rowSpan ().
Returns a frame iterator pointing to the end of the table's cell.
另请参阅 begin ().
Returns the first valid cursor position in this cell.
另请参阅 lastCursorPosition ().
Returns the cell's character format.
另请参阅 setFormat ().
返回
true
if this is a valid table cell; otherwise returns false.
Returns the last valid cursor position in this cell.
另请参阅 firstCursorPosition ().
Returns the number of the row in the table that contains this cell.
另请参阅 column ().
Returns the number of rows this cell spans. The default is 1.
另请参阅 columnSpan ().
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 代替。
另请参阅 format ().
Returns the index of the tableCell's format in the document's internal list of formats.
另请参阅 QTextDocument::allFormats ().
返回
true
if this cell object and the
other
cell object describe different cells; otherwise returns
false
.
赋值 other table cell to this table cell.
返回
true
if this cell object and the
other
cell object describe the same cell; otherwise returns
false
.