PySide6.QtGui.QTextTableCell¶
- class QTextTableCell¶
The
QTextTableCell
class represents the properties of a cell in aQTextTable
. More…Synopsis¶
Methods¶
def
__init__()
def
begin()
def
column()
def
columnSpan()
def
end()
def
firstPosition()
def
format()
def
isValid()
def
lastPosition()
def
__ne__()
def
__eq__()
def
row()
def
rowSpan()
def
setFormat()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
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
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()
andcolumn()
numbers of a cell, and itsrowSpan()
andcolumnSpan()
.The
format()
of a cell describes the default character format of its contents. ThefirstCursorPosition()
andlastCursorPosition()
functions are used to obtain the extent of the cell in the document.See also
- __init__()¶
Constructs an invalid table cell.
See also
- __init__(o)
- Parameters:
o –
QTextTableCell
Copy constructor. Creates a new
QTextTableCell
object based on theother
cell.- begin()¶
- Return type:
iterator
Returns a frame iterator pointing to the beginning of the table’s cell.
See also
- column()¶
- Return type:
int
Returns the number of the column in the table that contains this cell.
See also
- columnSpan()¶
- Return type:
int
Returns the number of columns this cell spans. The default is 1.
See also
- end()¶
- Return type:
iterator
Returns a frame iterator pointing to the end of the table’s cell.
See also
- firstCursorPosition()¶
- Return type:
Returns the first valid cursor position in this cell.
See also
- firstPosition()¶
- Return type:
int
- format()¶
- Return type:
Returns the cell’s character format.
See also
- isValid()¶
- Return type:
bool
Returns
true
if this is a valid table cell; otherwise returns false.- lastCursorPosition()¶
- Return type:
Returns the last valid cursor position in this cell.
See also
- lastPosition()¶
- Return type:
int
- __ne__(other)¶
- Parameters:
other –
QTextTableCell
- Return type:
bool
Returns
true
if this cell object and theother
cell object describe different cells; otherwise returnsfalse
.- __eq__(other)¶
- Parameters:
other –
QTextTableCell
- Return type:
bool
Returns
true
if this cell object and theother
cell object describe the same cell; otherwise returnsfalse
.- row()¶
- Return type:
int
Returns the number of the row in the table that contains this cell.
See also
- rowSpan()¶
- Return type:
int
Returns the number of rows this cell spans. The default is 1.
See also
- setFormat(format)¶
- Parameters:
format –
QTextCharFormat
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
mergeCells
andsplitCell
instead.See also
- tableCellFormatIndex()¶
- Return type:
int
Returns the index of the tableCell’s format in the document’s internal list of formats.
See also