QTextTableFormat¶
The
QTextTableFormat
class provides formatting information for tables in aQTextDocument
. More…
Synopsis¶
Functions¶
def
alignment
()def
borderCollapse
()def
cellPadding
()def
cellSpacing
()def
clearColumnWidthConstraints
()def
columnWidthConstraints
()def
columns
()def
headerRowCount
()def
setAlignment
(alignment)def
setBorderCollapse
(borderCollapse)def
setCellPadding
(padding)def
setCellSpacing
(spacing)def
setColumnWidthConstraints
(constraints)def
setColumns
(columns)def
setHeaderRowCount
(count)
Detailed Description¶
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 withsetAlignment()
.Cells within the table are separated by cell spacing. The number of pixels between cells is set with
setCellSpacing()
and read withcellSpacing()
. The contents of each cell is surrounded by cell padding. The number of pixels between each cell edge and its contents is set withsetCellPadding()
and read withcellPadding()
.The table’s background color can be read with the
background()
function, and can be specified withsetBackground()
. 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
). Thecolumns()
function returns the number of columns with constraints, and thecolumnWidthConstraints()
function returns the constraints defined for the table. These quantities can also be set by callingsetColumnWidthConstraints()
with a vector containing new constraints. If no constraints are required,clearColumnWidthConstraints()
can be used to remove them.See also
- class PySide2.QtGui.QTextTableFormat¶
PySide2.QtGui.QTextTableFormat(fmt)
PySide2.QtGui.QTextTableFormat(QTextTableFormat)
- param fmt:
- param QTextTableFormat:
Constructs a new table format object.
- PySide2.QtGui.QTextTableFormat.alignment()¶
- Return type:
Alignment
Returns the table’s alignment.
See also
- PySide2.QtGui.QTextTableFormat.borderCollapse()¶
- Return type:
bool
Returns true if is enabled.
See also
- PySide2.QtGui.QTextTableFormat.cellPadding()¶
- Return type:
float
Returns the table’s cell padding. This describes the distance between the border of a cell and its contents.
See also
- PySide2.QtGui.QTextTableFormat.cellSpacing()¶
- Return type:
float
Returns the table’s cell spacing. This describes the distance between adjacent cells.
See also
- PySide2.QtGui.QTextTableFormat.clearColumnWidthConstraints()¶
Clears the column width constraints for the table.
- PySide2.QtGui.QTextTableFormat.columnWidthConstraints()¶
- Return type:
Returns a list of constraints used by this table format to control the appearance of columns in a table.
See also
- PySide2.QtGui.QTextTableFormat.columns()¶
- Return type:
int
Returns the number of columns specified by the table format.
- PySide2.QtGui.QTextTableFormat.headerRowCount()¶
- Return type:
int
Returns the number of rows in the table that define the header.
See also
- PySide2.QtGui.QTextTableFormat.setAlignment(alignment)¶
- Parameters:
alignment –
Alignment
Sets the table’s
alignment
.See also
- PySide2.QtGui.QTextTableFormat.setBorderCollapse(borderCollapse)¶
- Parameters:
borderCollapse – bool
Enabling
borderCollapse
will have the following implications:With
borderCollapse
disabled, cell borders can still be styled usingQTextTableCellFormat
but styling will be applied only within the cell’s frame, which is probably not very useful in practice.
- PySide2.QtGui.QTextTableFormat.setCellPadding(padding)¶
- Parameters:
padding – float
Sets the cell
padding
for the table. This determines the distance between the border of a cell and its contents.See also
- PySide2.QtGui.QTextTableFormat.setCellSpacing(spacing)¶
- Parameters:
spacing – float
Sets the cell
spacing
for the table. This determines the distance between adjacent cells.This property will be ignored if
borderCollapse
is enabled.See also
- PySide2.QtGui.QTextTableFormat.setColumnWidthConstraints(constraints)¶
- Parameters:
constraints –
Sets the column width
constraints
for the table.
- PySide2.QtGui.QTextTableFormat.setHeaderRowCount(count)¶
- Parameters:
count – int
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
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.