QTextTableFormat露

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

Inheritance diagram of PySide2.QtGui.QTextTableFormat

Synopsis露

Functions露

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鈥檚 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() .

../../_images/qtexttableformat-cell.png

The table鈥檚 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.

class PySide2.QtGui.QTextTableFormat露

PySide2.QtGui.QTextTableFormat(fmt)

PySide2.QtGui.QTextTableFormat(QTextTableFormat)

param fmt:

PySide2.QtGui.QTextFormat

param QTextTableFormat:

PySide2.QtGui.QTextTableFormat

Constructs a new table format object.

PySide2.QtGui.QTextTableFormat.alignment()露
Return type:

Alignment

Returns the table鈥檚 alignment.

See also

setAlignment()

PySide2.QtGui.QTextTableFormat.borderCollapse()露
Return type:

bool

Returns true if is enabled.

PySide2.QtGui.QTextTableFormat.cellPadding()露
Return type:

float

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

See also

setCellPadding()

PySide2.QtGui.QTextTableFormat.cellSpacing()露
Return type:

float

Returns the table鈥檚 cell spacing. This describes the distance between adjacent cells.

See also

setCellSpacing()

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.

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.

PySide2.QtGui.QTextTableFormat.setAlignment(alignment)露
Parameters:

alignment 鈥� Alignment

Sets the table鈥檚 alignment .

See also

alignment()

PySide2.QtGui.QTextTableFormat.setBorderCollapse(borderCollapse)露
Parameters:

borderCollapse 鈥� bool

Enabling borderCollapse will have the following implications:

With borderCollapse disabled, cell borders can still be styled using QTextTableCellFormat but styling will be applied only within the cell鈥檚 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

cellPadding()

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

cellSpacing()

PySide2.QtGui.QTextTableFormat.setColumnWidthConstraints(constraints)露
Parameters:

constraints 鈥�

Sets the column width constraints for the table.

PySide2.QtGui.QTextTableFormat.setColumns(columns)露
Parameters:

columns 鈥� int

See also

columns()

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

headerRowCount()