Class: QgsAttributeTableConfig

class qgis.core.QgsAttributeTableConfig

Bases: sip.wrapper

Constructor for QgsAttributeTableConfig.

QgsAttributeTableConfig(QgsAttributeTableConfig)

This is a container for configuration of the attribute table. The configuration is specific for one vector layer.

New in version 2.16: Enums

Methods

actionWidgetStyle Gets the style of the action widget
actionWidgetVisible Returns True if the action widget is visible
columnHidden Returns True if the specified column is hidden.
columnWidth Returns the width of a column, or -1 if column should use default width.
columns Gets the list with all columns and their configuration.
hasSameColumns Compare this configuration’s columns name, type, and order to other.
isEmpty Returns True if the configuration is empty, ie it contains no columns.
mapVisibleColumnToIndex Maps a visible column index to its original column index.
readXml Deserialize to XML on layer load
setActionWidgetStyle Set the style of the action widget
setActionWidgetVisible Set if the action widget is visible
setColumnHidden Sets whether the specified column should be hidden.
setColumnWidth Sets the width of a column.
setColumns Set the list of columns visible in the attribute table.
setSortExpression Set the sort expression used for sorting.
setSortOrder Set the sort order
sortExpression Gets the expression used for sorting.
sortOrder Gets the sort order
update Update the configuration with the given fields.
writeXml Serialize to XML on layer save

Signals

Attributes

Action
ButtonList
DropDown
Field
Action = 1
class ActionWidgetStyle

Bases: int

ButtonList = 0
class ColumnConfig

Bases: sip.wrapper

Constructor for ColumnConfig

QgsAttributeTableConfig.ColumnConfig(QgsAttributeTableConfig.ColumnConfig)

hidden
name
type
width
DropDown = 1
Field = 0
class Type

Bases: int

actionWidgetStyle(self) → QgsAttributeTableConfig.ActionWidgetStyle

Gets the style of the action widget

actionWidgetVisible(self) → bool

Returns True if the action widget is visible

columnHidden(self, column: int) → bool

Returns True if the specified column is hidden.

Parameters:column – column index
columnWidth(self, column: int) → int

Returns the width of a column, or -1 if column should use default width.

Parameters:column – column index

See also

setColumnWidth()

columns(self) → object

Gets the list with all columns and their configuration. The list order defines the order of appearance.

hasSameColumns(self, other: QgsAttributeTableConfig) → bool

Compare this configuration’s columns name, type, and order to other. The column’s width is not considered.

isEmpty(self) → bool

Returns True if the configuration is empty, ie it contains no columns.

mapVisibleColumnToIndex(self, visibleColumn: int) → int

Maps a visible column index to its original column index.

Parameters:visibleColumn – index of visible column
Returns:corresponding index when hidden columns are considered
readXml(self, node: QDomNode)

Deserialize to XML on layer load

setActionWidgetStyle(self, actionWidgetStyle: QgsAttributeTableConfig.ActionWidgetStyle)

Set the style of the action widget

setActionWidgetVisible(self, visible: bool)

Set if the action widget is visible

setColumnHidden(self, column: int, hidden: bool)

Sets whether the specified column should be hidden.

Parameters:
  • column – column index
  • hidden – set to True to hide column

See also

columnHidden()

setColumnWidth(self, column: int, width: int)

Sets the width of a column.

Parameters:
  • column – column index
  • width – column width in pixels, or -1 if column should use default width

See also

columnWidth()

setColumns(self, columns: Iterable[QgsAttributeTableConfig.ColumnConfig])

Set the list of columns visible in the attribute table. The list order defines the order of appearance.

setSortExpression(self, sortExpression: str)

Set the sort expression used for sorting.

setSortOrder(self, sortOrder: Qt.SortOrder)

Set the sort order

New in version 2.16.

sortExpression(self) → str

Gets the expression used for sorting.

sortOrder(self) → Qt.SortOrder

Gets the sort order

New in version 2.16.

update(self, fields: QgsFields)

Update the configuration with the given fields. Any field which is present in the configuration but not present in the parameter fields will be removed. Any field which is in the parameter fields but not in the configuration will be appended.

writeXml(self, node: QDomNode)

Serialize to XML on layer save