Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |
The QTextTable class represents a table in a QTextDocument. More...
#include <QTextTable>
Inherits QTextFrame.
The QTextTable class represents a table in a QTextDocument.
A table is a group of cells ordered into rows and columns. Each table contains at least one row and one column. Each cell contains a block, and is surrounded by a frame.
Tables are usually created and inserted into a document with the QTextCursor::insertTable() function. For example, we can insert a table with three rows and two columns at the current cursor position in an editor using the following lines of code:
QTextCursor cursor(editor->textCursor()); cursor.movePosition(QTextCursor::Start); QTextTable *table = cursor.insertTable(rows, columns, tableFormat);
The table format is either defined when the table is created or changed later with setFormat().
The table currently being edited by the cursor is found with QTextCursor::currentTable(). This allows its format or dimensions to be changed after it has been inserted into a document.
A table's size can be changed with resize(), or by using insertRows(), insertColumns(), removeRows(), or removeColumns(). Use cellAt() to retrieve table cells.
The starting and ending positions of table rows can be found by moving a cursor within a table, and using the rowStart() and rowEnd() functions to obtain cursors at the start and end of each row.
See also QTextTableFormat.
Returns the table cell at the given row and column in the table.
See also columns() and rows().
This is an overloaded member function, provided for convenience.
Returns the table cell that contains the character at the given position in the document.
This is an overloaded member function, provided for convenience.
Returns the table cell containing the given cursor.
Returns the number of columns in the table.
See also rows().
Returns the table's format.
See also setFormat().
Inserts a number of columns before the column with the specified index.
See also insertRows(), resize(), removeRows(), and removeColumns().
Inserts a number of rows before the row with the specified index.
See also resize(), insertColumns(), removeRows(), and removeColumns().
Merges the cell at the specified row and column with the adjacent cells into one cell. The new cell will span numRows rows and numCols columns. If numRows or numCols is less than the current number of rows or columns the cell spans then this method does nothing.
This function was introduced in Qt 4.1.
This is an overloaded member function, provided for convenience.
Merges the cells selected by the provided cursor.
This function was introduced in Qt 4.1.
Removes a number of columns starting with the column at the specified index.
See also insertRows(), insertColumns(), removeRows(), and resize().
Removes a number of rows starting with the row at the specified index.
See also insertRows(), insertColumns(), resize(), and removeColumns().
Resizes the table to contain the required number of rows and columns.
See also insertRows(), insertColumns(), removeRows(), and removeColumns().
Returns a cursor pointing to the end of the row that contains the given cursor.
See also rowStart().
Returns a cursor pointing to the start of the row that contains the given cursor.
See also rowEnd().
Returns the number of rows in the table.
See also columns().
Sets the table's format.
See also format().
Splits the specfied cell at row and column into an array of multiple cells with dimensions specified by numRows and numCols.
This function was introduced in Qt 4.1.
Copyright © 2006 Trolltech | Trademarks | Qt 4.1.3 |