Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QTextTable Class Reference

The QTextTable class represents a table in a QTextDocument. More...

    #include <QTextTable>

Inherits QTextFrame.

- List of all members, including inherited members

### Writable Properties

- 1 writable property inherited from QObject

### Public Functions

- QTextTableCell cellAt ( int row, int column ) const
- QTextTableCell cellAt ( int position ) const
- QTextTableCell cellAt ( const QTextCursor & cursor ) const
- int columns () const
- QTextTableFormat format () const
- void insertColumns ( int index, int columns )
- void insertRows ( int index, int rows )
- void removeColumns ( int index, int columns )
- void removeRows ( int index, int rows )
- void resize ( int rows, int columns )
- QTextCursor rowEnd ( const QTextCursor & cursor ) const
- QTextCursor rowStart ( const QTextCursor & cursor ) const
- int rows () const
- void setFormat ( const QTextTableFormat & format )

- 10 public functions inherited from QTextFrame
- 3 public functions inherited from QTextObject
- 24 public functions inherited from QObject

### Public Slots

- 1 public slot inherited from QObject

### Signals

- 1 signal inherited from QObject

### Static Public Members

- 4 static public members inherited from QObject

### Protected Functions

- 1 protected function inherited from QTextObject
- 9 protected functions inherited from QObject

## Detailed Description

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.

Tables can be created and inserted into a document with the QTextCursor::createTable() function. The table currently being edited by the cursor is found with QTextCursor::currentTable().

A table's size can be changed with resize(), or by using insertRows(), insertColumns(), removeRows(), or removeColumns(). The overall format of the table can be changed with setFormat(). 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.

## Member Function Documentation

### QTextTableCell QTextTable::cellAt ( int row, int column ) const

Returns the table cell at the given row and column in the table.

See also columns() and rows().

### QTextTableCell QTextTable::cellAt ( int position ) const

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns the table cell that contains the character at the given position in the document.

### QTextTableCell QTextTable::cellAt ( const QTextCursor & cursor ) const

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Returns the table cell containing the given cursor.

### int QTextTable::columns () const

Returns the number of columns in the table.

See also rows().

### QTextTableFormat QTextTable::format () const

Returns the table's format.

See also setFormat().

### void QTextTable::insertColumns ( int index, int columns )

Inserts a number of columns before the column with the specified index.

See also insertRows(), resize(), removeRows(), and removeColumns().

### void QTextTable::insertRows ( int index, int rows )

Inserts a number of rows before the row with the specified index.

See also resize(), insertColumns(), removeRows(), and removeColumns().

### void QTextTable::removeColumns ( int index, int columns )

Removes a number of columns starting with the column at the specified index.

See also insertRows(), insertColumns(), removeRows(), and resize().

### void QTextTable::removeRows ( int index, int rows )

Removes a number of rows starting with the row at the specified index.

See also insertRows(), insertColumns(), resize(), and removeColumns().

### void QTextTable::resize ( int rows, int columns )

Resizes the table to contain the required number of rows and columns.

See also insertRows(), insertColumns(), removeRows(), and removeColumns().

### QTextCursor QTextTable::rowEnd ( const QTextCursor & cursor ) const

Returns a cursor pointing to the end of the row that contains the given cursor.

See also rowStart().

### QTextCursor QTextTable::rowStart ( const QTextCursor & cursor ) const

Returns a cursor pointing to the start of the row that contains the given cursor.

See also rowEnd().

### int QTextTable::rows () const

Returns the number of rows in the table.

See also columns().

### void QTextTable::setFormat ( const QTextTableFormat & format )

Sets the table's format.

See also format().