CopperSpice API  1.9.1
QTextTableFormat Class Reference

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

Inheritance diagram for QTextTableFormat:
QTextFrameFormat QTextFormat

Public Methods

 QTextTableFormat ()
Qt::Alignment alignment () const
qreal cellPadding () const
qreal cellSpacing () const
void clearColumnWidthConstraints ()
int columns () const
QVector< QTextLengthcolumnWidthConstraints () const
int headerRowCount () const
bool isValid () const
void setAlignment (Qt::Alignment alignment)
void setCellPadding (qreal padding)
void setCellSpacing (qreal spacing)
void setColumnWidthConstraints (const QVector< QTextLength > &constraints)
void setHeaderRowCount (int count)
- Public Methods inherited from QTextFrameFormat
 QTextFrameFormat ()
qreal border () const
QBrush borderBrush () const
BorderStyle borderStyle () const
qreal bottomMargin () const
QTextLength height () const
bool isValid () const
qreal leftMargin () const
qreal margin () const
qreal padding () const
PageBreakFlags pageBreakPolicy () const
Position position () const
qreal rightMargin () const
void setBorder (qreal width)
void setBorderBrush (const QBrush &brush)
void setBorderStyle (BorderStyle style)
void setBottomMargin (qreal margin)
void setHeight (const QTextLength &height)
void setHeight (qreal height)
void setLeftMargin (qreal margin)
void setMargin (qreal margin)
void setPadding (qreal width)
void setPageBreakPolicy (PageBreakFlags policy)
void setPosition (Position policy)
void setRightMargin (qreal margin)
void setTopMargin (qreal margin)
void setWidth (const QTextLength &width)
void setWidth (qreal width)
qreal topMargin () const
QTextLength width () const
- Public Methods inherited from QTextFormat
 QTextFormat ()
 QTextFormat (const QTextFormat &other)
 QTextFormat (int type)
 ~QTextFormat ()
QBrush background () const
bool boolProperty (int propertyId) const
QBrush brushProperty (int propertyId) const
void clearBackground ()
void clearForeground ()
void clearProperty (int propertyId)
QColor colorProperty (int propertyId) const
qreal doubleProperty (int propertyId) const
QBrush foreground () const
bool hasProperty (int propertyId) const
int intProperty (int propertyId) const
bool isBlockFormat () const
bool isCharFormat () const
bool isEmpty () const
bool isFrameFormat () const
bool isImageFormat () const
bool isListFormat () const
bool isTableCellFormat () const
bool isTableFormat () const
bool isValid () const
Qt::LayoutDirection layoutDirection () const
QTextLength lengthProperty (int propertyId) const
QVector< QTextLengthlengthVectorProperty (int propertyId) const
void merge (const QTextFormat &other)
int objectIndex () const
int objectType () const
 operator QVariant () const
bool operator!= (const QTextFormat &other) const
QTextFormat & operator= (const QTextFormat &other)
bool operator== (const QTextFormat &other) const
QPen penProperty (int propertyId) const
QMap< int, QVariantproperties () const
QVariant property (int propertyId) const
int propertyCount () const
void setBackground (const QBrush &brush)
void setForeground (const QBrush &brush)
void setLayoutDirection (Qt::LayoutDirection direction)
void setObjectIndex (int index)
void setObjectType (int type)
void setProperty (int propertyId, const QVariant &value)
void setProperty (int propertyId, const QVector< QTextLength > &value)
QString stringProperty (int propertyId) const
void swap (QTextFormat &other)
QTextBlockFormat toBlockFormat () const
QTextCharFormat toCharFormat () const
QTextFrameFormat toFrameFormat () const
QTextImageFormat toImageFormat () const
QTextListFormat toListFormat () const
QTextTableCellFormat toTableCellFormat () const
QTextTableFormat toTableFormat () const
int type () const


class QTextFormat

Additional Inherited Members

- Public Types inherited from QTextFrameFormat
enum  BorderStyle
enum  Position
- Public Types inherited from QTextFormat
enum  FormatType
enum  ObjectTypes
enum  Property

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. Tables in rich text documents are formatted using the properties defined in this class.

Tables are horizontally justified within their parent frame according to the table's alignment. This can be read with the alignment() function and set with setAlignment().

Cells within the table are separated by cell spacing. The number of pixels between cells is set with setCellSpacing() and read with cellSpacing(). The contents of each cell is surrounded by cell padding. The number of pixels between each cell edge and its contents is set with setCellPadding() and read with cellPadding().

The table's background color can be read with the background() function, and can be specified with setBackground(). The background color of each cell can be set independently, and will control the color of the cell within the padded area.

The table format also provides a way to constrain the widths of the columns in the table. Columns can be assigned a fixed width, a variable width, or a percentage of the available width (see QTextLength). The columns() function returns the number of columns with constraints, and the columnWidthConstraints() function returns the constraints defined for the table. These quantities can also be set by calling setColumnWidthConstraints() with a vector containing new constraints. If no constraints are required, clearColumnWidthConstraints() can be used to remove them.

See also
QTextTable, QTextTableCell, QTextLength

Constructor & Destructor Documentation

QTextTableFormat::QTextTableFormat ( )

Constructs a new table format object.

Method Documentation

Qt::Alignment QTextTableFormat::alignment ( ) const

Returns the table's alignment.

See also
qreal QTextTableFormat::cellPadding ( ) const

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

See also
qreal QTextTableFormat::cellSpacing ( ) const

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

See also
void QTextTableFormat::clearColumnWidthConstraints ( )

Clears the column width constraints for the table.

See also
columnWidthConstraints(), setColumnWidthConstraints()
int QTextTableFormat::columns ( ) const

Returns the number of columns specified by the table format.

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
int QTextTableFormat::headerRowCount ( ) const

Returns the number of rows in the table that define the header.

See also
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
void QTextTableFormat::setCellPadding ( qreal  padding)

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

See also
void QTextTableFormat::setCellSpacing ( qreal  spacing)

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

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

Sets the column width constraints for the table.

See also
columnWidthConstraints(), clearColumnWidthConstraints()
void QTextTableFormat::setHeaderRowCount ( int  count)

Declares the first count rows of the table as table header. The table header rows get repeated when a table is broken across a page boundary.

See also