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

# QTextTableFormat Class Reference

The QTextTableFormat class provides formatting information for tables in a QTextDocument. More...

    #include <QTextTableFormat>

Inherits QTextFrameFormat.

- List of all members, including inherited members

### Public Functions

- QTextTableFormat ()
- Qt::Alignment alignment () const
- QColor backgroundColor () const
- int cellPadding () const
- int cellSpacing () const
- void clearBackgroundColor ()
- QVector<QTextLength> columnWidthConstraints () const
- int columns () const
- bool isValid () const
- void setAlignment ( Qt::Alignment alignment )
- void setBackgroundColor ( const QColor & color )
- void setCellPadding ( int padding )
- void setCellSpacing ( int spacing )
- void setColumnWidthConstraints ( const QVector<QTextLength> & constraints )
- void setColumns ( int columns )

- 14 public functions inherited from QTextFrameFormat
- 45 public functions inherited from QTextFormat

## Detailed Description

The QTextTableFormat class provides formatting information for tables 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.

A QTextTableFormat specifies the characteristics of a table. The setColumns() function sets the number of columns; the number of rows is automatically derived based on the number of columns and the number of cells (blocks) contained in the table.

See also QTextTable.

## Member Function Documentation

### QTextTableFormat::QTextTableFormat ()

Constructs a new table format object.

### Qt::Alignment QTextTableFormat::alignment () const

Returns the table's alignment.

See also setAlignment().

### QColor QTextTableFormat::backgroundColor () const

Returns the table's background color.

See also setBackgroundColor().

### int QTextTableFormat::cellPadding () const

Returns the table's cell padding. This describes the distance between the border of a cell and its contents.

### int QTextTableFormat::cellSpacing () const

Returns the table's cell spacing. This describes the distance between adjacent cells.

### void QTextTableFormat::clearBackgroundColor ()

Clears the table's background color. The default background color will be used for the table.

See also backgroundColor() and setBackgroundColor().

### QVector<QTextLength> QTextTableFormat::columnWidthConstraints () const

Returns a list of constraints used by this table format to control the appearance of columns in a table.

See also setColumnWidthConstraints().

### int QTextTableFormat::columns () const

Returns the number of columns specified by the table format.

See also setColumns().

### bool QTextTableFormat::isValid () const

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

### void QTextTableFormat::setAlignment ( Qt::Alignment alignment )

Sets the table's alignment.

See also alignment().

### void QTextTableFormat::setBackgroundColor ( const QColor & color )

Sets the table's background color.

See also backgroundColor().

### void QTextTableFormat::setCellPadding ( int padding )

Sets the cell padding for the table. This determines the distance between the border of a cell and its contents.

### void QTextTableFormat::setCellSpacing ( int spacing )

Sets the cell spacing for the table. This determines the distance between adjacent cells.

### void QTextTableFormat::setColumnWidthConstraints ( const QVector<QTextLength> & constraints )

Sets the column width constraints for the table.

See also columnWidthConstraints().

### void QTextTableFormat::setColumns ( int columns )

Sets the number of columns required by the table format.

See also columns().