QTextTableFormat 類提供格式化信息為錶格在 QTextDocument . 更多...
| 頭: | #include <QTextTableFormat> |
| qmake: | QT += gui |
| 繼承: | QTextFrameFormat |
注意: 此類的所有函數 可重入 .
| QTextTableFormat () | |
| Qt::Alignment | alignment () const |
| bool | borderCollapse () const |
| qreal | cellPadding () const |
| qreal | cellSpacing () const |
| void | clearColumnWidthConstraints () |
| QVector<QTextLength> | columnWidthConstraints () const |
| int | columns () const |
| int | headerRowCount () const |
| bool | isValid () const |
| void | setAlignment (Qt::Alignment alignment ) |
| void | setBorderCollapse (bool borderCollapse ) |
| void | setCellPadding (qreal padding ) |
| void | setCellSpacing (qreal spacing ) |
| void | setColumnWidthConstraints (const QVector<QTextLength> & constraints ) |
| void | setHeaderRowCount (int count ) |
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 )。 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.
另請參閱 QTextTable , QTextTableCell ,和 QTextLength .
構造新的錶格格式對象。
返迴錶格的對齊方式。
另請參閱 setAlignment ().
Returns true if borderCollapse is enabled.
該函數在 Qt 5.14 引入。
另請參閱 setBorderCollapse ().
返迴錶格的單元格鋪墊。這描述單元格邊框與其內容之間的距離。
另請參閱 setCellPadding ().
Returns the table's cell spacing. This describes the distance between adjacent cells.
另請參閱 setCellSpacing ().
Clears the column width constraints for the table.
另請參閱 columnWidthConstraints () 和 setColumnWidthConstraints ().
Returns a list of constraints used by this table format to control the appearance of columns in a table.
另請參閱 setColumnWidthConstraints ().
Returns the number of columns specified by the table format.
Returns the number of rows in the table that define the header.
該函數在 Qt 4.2 引入。
另請參閱 setHeaderRowCount ().
返迴
true
if this table format is valid; otherwise returns
false
.
Sets the table's alignment .
另請參閱 alignment ().
Enabling borderCollapse will have the following implications:
border-collapse
:
collapse
rules
border
property to a minimum value of
1
will render a one pixel solid inner table grid using the
borderBrush
property and an outer border as specified
采用 borderCollapse disabled, cell borders can still be styled using QTextTableCellFormat but styling will be applied only within the cell's frame, which is probably not very useful in practice.
該函數在 Qt 5.14 引入。
另請參閱 borderCollapse (), setBorder (), setBorderBrush (), setBorderStyle (),和 QTextTableCellFormat .
Sets the cell padding for the table. This determines the distance between the border of a cell and its contents.
另請參閱 cellPadding ().
Sets the cell spacing for the table. This determines the distance between adjacent cells.
This property will be ignored if borderCollapse 被啓用。
另請參閱 cellSpacing ().
Sets the column width constraints for the table.
另請參閱 columnWidthConstraints () 和 clearColumnWidthConstraints ().
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.
該函數在 Qt 4.2 引入。
另請參閱 headerRowCount ().