Qt 4.8
|
The QTextTableFormat class provides formatting information for tables in a QTextDocument. More...
#include <qtextformat.h>
Public Functions | |
Qt::Alignment | alignment () const |
Returns the table's alignment. More... | |
qreal | cellPadding () const |
Returns the table's cell padding. More... | |
qreal | cellSpacing () const |
Returns the table's cell spacing. More... | |
void | clearColumnWidthConstraints () |
Clears the column width constraints for the table. More... | |
int | columns () const |
Returns the number of columns specified by the table format. More... | |
QVector< QTextLength > | columnWidthConstraints () const |
Returns a list of constraints used by this table format to control the appearance of columns in a table. More... | |
int | headerRowCount () const |
Returns the number of rows in the table that define the header. More... | |
bool | isValid () const |
Returns true if this table format is valid; otherwise returns false. More... | |
QTextTableFormat () | |
Constructs a new table format object. More... | |
void | setAlignment (Qt::Alignment alignment) |
Sets the table's alignment. More... | |
void | setCellPadding (qreal padding) |
Sets the cell padding for the table. More... | |
void | setCellSpacing (qreal spacing) |
Sets the cell spacing for the table. More... | |
void | setColumns (int columns) |
Sets the number of columns required by the table format. More... | |
void | setColumnWidthConstraints (const QVector< QTextLength > &constraints) |
Sets the column width constraints for the table. More... | |
void | setHeaderRowCount (int count) |
Declares the first count rows of the table as table header. More... | |
Public Functions inherited from QTextFrameFormat | |
qreal | border () const |
Returns the width of the border in pixels. More... | |
QBrush | borderBrush () const |
Returns the brush used for the frame's border. More... | |
BorderStyle | borderStyle () const |
Returns the style of the frame's border. More... | |
qreal | bottomMargin () const |
Returns the width of the frame's bottom margin in pixels. More... | |
QTextLength | height () const |
Returns the height of the frame's border rectangle. More... | |
bool | isValid () const |
Returns true if the format description is valid; otherwise returns false. More... | |
qreal | leftMargin () const |
Returns the width of the frame's left margin in pixels. More... | |
qreal | margin () const |
Returns the width of the frame's external margin in pixels. More... | |
qreal | padding () const |
Returns the width of the frame's internal padding in pixels. More... | |
PageBreakFlags | pageBreakPolicy () const |
Returns the currently set page break policy for the frame/table. More... | |
Position | position () const |
Returns the positioning policy for frames with this frame format. More... | |
QTextFrameFormat () | |
Constructs a text frame format object with the default properties. More... | |
qreal | rightMargin () const |
Returns the width of the frame's right margin in pixels. More... | |
void | setBorder (qreal border) |
Sets the width (in pixels) of the frame's border. More... | |
void | setBorderBrush (const QBrush &brush) |
Sets the brush used for the frame's border. More... | |
void | setBorderStyle (BorderStyle style) |
Sets the style of the frame's border. More... | |
void | setBottomMargin (qreal margin) |
Sets the frame's bottom margin in pixels. More... | |
void | setHeight (qreal height) |
Sets the frame's height. More... | |
void | setHeight (const QTextLength &height) |
Sets the frame's height. More... | |
void | setLeftMargin (qreal margin) |
Sets the frame's left margin in pixels. More... | |
void | setMargin (qreal margin) |
Sets the frame's margin in pixels. More... | |
void | setPadding (qreal padding) |
Sets the width of the frame's internal padding in pixels. More... | |
void | setPageBreakPolicy (PageBreakFlags flags) |
Sets the page break policy for the frame/table to policy. More... | |
void | setPosition (Position f) |
Sets the policy for positioning frames with this frame format. More... | |
void | setRightMargin (qreal margin) |
Sets the frame's right margin in pixels. More... | |
void | setTopMargin (qreal margin) |
Sets the frame's top margin in pixels. More... | |
void | setWidth (qreal width) |
Convenience method that sets the width of the frame's border rectangle's width to the specified fixed width. More... | |
void | setWidth (const QTextLength &length) |
Sets the frame's border rectangle's width. More... | |
qreal | topMargin () const |
Returns the width of the frame's top margin in pixels. More... | |
QTextLength | width () const |
Returns the width of the frame's border rectangle. More... | |
Public Functions inherited from QTextFormat | |
QBrush | background () const |
Returns the brush used to paint the document's background. More... | |
bool | boolProperty (int propertyId) const |
Returns the value of the property specified by propertyId. More... | |
QBrush | brushProperty (int propertyId) const |
Returns the value of the property given by propertyId; if the property isn't of QVariant::Brush type, Qt::NoBrush is returned instead. More... | |
void | clearBackground () |
Clears the brush used to paint the document's background. More... | |
void | clearForeground () |
Clears the brush used to paint the document's foreground. More... | |
void | clearProperty (int propertyId) |
Clears the value of the property given by propertyId. More... | |
QColor | colorProperty (int propertyId) const |
Returns the value of the property given by propertyId; if the property isn't of QVariant::Color type, an invalid color is returned instead. More... | |
qreal | doubleProperty (int propertyId) const |
Returns the value of the property specified by propertyId. More... | |
QBrush | foreground () const |
Returns the brush used to render foreground details, such as text, frame outlines, and table borders. More... | |
bool | hasProperty (int propertyId) const |
Returns true if the text format has a property with the given propertyId; otherwise returns false. More... | |
int | intProperty (int propertyId) const |
Returns the value of the property specified by propertyId. More... | |
bool | isBlockFormat () const |
Returns true if this text format is a BlockFormat ; otherwise returns false. More... | |
bool | isCharFormat () const |
Returns true if this text format is a CharFormat ; otherwise returns false. More... | |
bool | isFrameFormat () const |
Returns true if this text format is a FrameFormat ; otherwise returns false. More... | |
bool | isImageFormat () const |
Returns true if this text format is an image format; otherwise returns false. More... | |
bool | isListFormat () const |
Returns true if this text format is a ListFormat ; otherwise returns false. More... | |
bool | isTableCellFormat () const |
Returns true if this text format is a TableCellFormat ; otherwise returns false. More... | |
bool | isTableFormat () const |
Returns true if this text format is a TableFormat ; otherwise returns false. More... | |
bool | isValid () const |
Returns true if the format is valid (i. More... | |
Qt::LayoutDirection | layoutDirection () const |
Returns the document's layout direction. More... | |
QTextLength | lengthProperty (int propertyId) const |
Returns the value of the property given by propertyId. More... | |
QVector< QTextLength > | lengthVectorProperty (int propertyId) const |
Returns the value of the property given by propertyId. More... | |
void | merge (const QTextFormat &other) |
Merges the other format with this format; where there are conflicts the other format takes precedence. More... | |
int | objectIndex () const |
Returns the index of the format object, or -1 if the format object is invalid. More... | |
int | objectType () const |
Returns the text format's object type. More... | |
operator QVariant () const | |
Returns the text format as a QVariant. More... | |
bool | operator!= (const QTextFormat &rhs) const |
Returns true if this text format is different from the other text format. More... | |
QTextFormat & | operator= (const QTextFormat &rhs) |
Assigns the other text format to this text format, and returns a reference to this text format. More... | |
bool | operator== (const QTextFormat &rhs) const |
Returns true if this text format is the same as the other text format. More... | |
QPen | penProperty (int propertyId) const |
Returns the value of the property given by propertyId; if the property isn't of QVariant::Pen type, Qt::NoPen is returned instead. More... | |
QMap< int, QVariant > | properties () const |
Returns a map with all properties of this text format. More... | |
QVariant | property (int propertyId) const |
Returns the property specified by the given propertyId. More... | |
int | propertyCount () const |
Returns the number of properties stored in the format. More... | |
QTextFormat () | |
Creates a new text format with an InvalidFormat . More... | |
QTextFormat (int type) | |
Creates a new text format of the given type. More... | |
QTextFormat (const QTextFormat &rhs) | |
Creates a new text format with the same attributes as the other text format. More... | |
void | setBackground (const QBrush &brush) |
Sets the brush use to paint the document's background to the brush specified. More... | |
void | setForeground (const QBrush &brush) |
Sets the foreground brush to the specified brush. More... | |
void | setLayoutDirection (Qt::LayoutDirection direction) |
Sets the document's layout direction to the specified direction. More... | |
void | setObjectIndex (int object) |
Sets the format object's object index. More... | |
void | setObjectType (int type) |
Sets the text format's object type to type. More... | |
void | setProperty (int propertyId, const QVariant &value) |
Sets the property specified by the propertyId to the given value. More... | |
void | setProperty (int propertyId, const QVector< QTextLength > &lengths) |
Sets the value of the property given by propertyId to value. More... | |
QString | stringProperty (int propertyId) const |
Returns the value of the property given by propertyId; if the property isn't of QVariant::String type, an empty string is returned instead. More... | |
QTextBlockFormat | toBlockFormat () const |
Returns this format as a block format. More... | |
QTextCharFormat | toCharFormat () const |
Returns this format as a character format. More... | |
QTextFrameFormat | toFrameFormat () const |
Returns this format as a frame format. More... | |
QTextImageFormat | toImageFormat () const |
Returns this format as an image format. More... | |
QTextListFormat | toListFormat () const |
Returns this format as a list format. More... | |
QTextTableCellFormat | toTableCellFormat () const |
Returns this format as a table cell format. More... | |
QTextTableFormat | toTableFormat () const |
Returns this format as a table format. More... | |
int | type () const |
Returns the type of this format. More... | |
~QTextFormat () | |
Destroys this text format. More... | |
Protected Functions | |
QTextTableFormat (const QTextFormat &fmt) | |
Creates a new table format with the same attributes as the given text format. More... | |
Protected Functions inherited from QTextFrameFormat | |
QTextFrameFormat (const QTextFormat &fmt) | |
Creates a new frame format with the same attributes as the given text format. More... | |
Friends | |
class | QTextFormat |
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.
Definition at line 842 of file qtextformat.h.
QTextTableFormat::QTextTableFormat | ( | ) |
Constructs a new table format object.
Definition at line 3262 of file qtextformat.cpp.
|
explicitprotected |
Creates a new table format with the same attributes as the given text format.
Definition at line 3280 of file qtextformat.cpp.
|
inline |
Returns the table's alignment.
Definition at line 872 of file qtextformat.h.
Referenced by QTextHtmlExporter::emitTable(), and QTextDocumentLayoutPrivate::layoutFlow().
|
inline |
Returns the table's cell padding.
This describes the distance between the border of a cell and its contents.
Definition at line 867 of file qtextformat.h.
Referenced by QTextHtmlExporter::emitTable(), and QTextDocumentLayoutPrivate::layoutTable().
|
inline |
Returns the table's cell spacing.
This describes the distance between adjacent cells.
Definition at line 862 of file qtextformat.h.
Referenced by QTextHtmlExporter::emitTable(), and QTextDocumentLayoutPrivate::layoutTable().
|
inline |
Clears the column width constraints for the table.
Definition at line 859 of file qtextformat.h.
Referenced by QTextCopyHelper::copy().
|
inline |
Returns the number of columns specified by the table format.
Definition at line 849 of file qtextformat.h.
Referenced by QTextTable::insertColumns(), and QTextTable::removeColumns().
|
inline |
Returns a list of constraints used by this table format to control the appearance of columns in a table.
Definition at line 856 of file qtextformat.h.
Referenced by QTextHtmlExporter::emitTable(), QTextTable::insertColumns(), QTextDocumentLayoutPrivate::layoutTable(), and QTextTable::removeColumns().
|
inline |
Returns the number of rows in the table that define the header.
Definition at line 877 of file qtextformat.h.
Referenced by QTextDocumentLayoutPrivate::drawFrame(), QTextDocumentLayoutPrivate::drawTableCell(), QTextHtmlExporter::emitTable(), and QTextDocumentLayoutPrivate::layoutTable().
|
inline |
Returns true if this table format is valid; otherwise returns false.
Definition at line 847 of file qtextformat.h.
|
inline |
Sets the table's alignment.
Definition at line 895 of file qtextformat.h.
Referenced by QTextHtmlImporter::scanTable().
|
inline |
Sets the cell padding for the table.
This determines the distance between the border of a cell and its contents.
Definition at line 892 of file qtextformat.h.
Referenced by QTextHtmlImporter::scanTable().
|
inline |
Sets the cell spacing for the table.
This determines the distance between adjacent cells.
Definition at line 864 of file qtextformat.h.
Referenced by QTextTableFormat(), and QTextHtmlImporter::scanTable().
|
inline |
Sets the number of columns required by the table format.
Definition at line 885 of file qtextformat.h.
Referenced by QTextCopyHelper::copy(), QTextTablePrivate::createTable(), QTextTable::insertColumns(), QTextTable::removeColumns(), QTextHtmlImporter::scanTable(), and QTextTable::setFormat().
|
inline |
Sets the column width constraints for the table.
Definition at line 853 of file qtextformat.h.
Referenced by QTextTable::insertColumns(), QTextTable::removeColumns(), and QTextHtmlImporter::scanTable().
|
inline |
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.
Definition at line 875 of file qtextformat.h.
Referenced by QTextHtmlImporter::scanTable().
|
friend |
Definition at line 882 of file qtextformat.h.