QTextTableCell Class Reference

[ QtGui module]

The QTextTableCell class represents the properties of a cell in a QTextTable . 更多...

方法

Special Methods


详细描述

The QTextTableCell class represents the properties of a cell in a QTextTable .

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 (),但 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 () and columnSpan ().

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 文档。


方法文档编制

QTextTableCell.__init__ ( self )

Constructs an invalid table cell.

另请参阅 isValid ().

QTextTableCell.__init__ ( self , QTextTableCell   o )

Copy constructor. Creates a new QTextTableCell object based on the other cell.

int QTextTableCell.column ( self )

Returns the number of the column in the table that contains this cell.

另请参阅 row ().

int QTextTableCell.columnSpan ( self )

Returns the number of columns this cell spans. The default is 1.

另请参阅 rowSpan ().

QTextCursor QTextTableCell.firstCursorPosition ( self )

Returns the first valid cursor position in this cell.

另请参阅 lastCursorPosition ().

QTextCharFormat QTextTableCell.format ( self )

Returns the cell's character format.

另请参阅 setFormat ().

bool QTextTableCell.isValid ( self )

Returns true if this is a valid table cell; otherwise returns false.

QTextCursor QTextTableCell.lastCursorPosition ( self )

Returns the last valid cursor position in this cell.

另请参阅 firstCursorPosition ().

int QTextTableCell.row ( self )

Returns the number of the row in the table that contains this cell.

另请参阅 column ().

int QTextTableCell.rowSpan ( self )

Returns the number of rows this cell spans. The default is 1.

另请参阅 columnSpan ().

QTextTableCell.setFormat ( self , 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.

该函数在 Qt 4.2 引入。

另请参阅 format ().

int QTextTableCell.tableCellFormatIndex ( self )

Returns the index of the tableCell's format in the document's internal list of formats.

该函数在 Qt 4.5 引入。

另请参阅 QTextDocument.allFormats ().

bool QTextTableCell.__eq__ ( self , QTextTableCell   other )

bool QTextTableCell.__ne__ ( self , QTextTableCell   other )