QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
QgsAttributeTableConfig Class Reference

A container for configuration of the attribute table. More...

#include <qgsattributetableconfig.h>

Classes

struct  ColumnConfig
 Defines the configuration of a column in the attribute table. More...

Public Types

enum  ActionWidgetStyle { ButtonList , DropDown }
 The style of the action widget in the attribute table. More...
enum  Type { Field , Action }
 The type of an attribute table column. More...

Public Member Functions

 QgsAttributeTableConfig ()=default
ActionWidgetStyle actionWidgetStyle () const
 Gets the style of the action widget.
bool actionWidgetVisible () const
 Returns true if the action widget is visible.
bool columnHidden (int column) const
 Returns true if the specified column is hidden.
QVector< QgsAttributeTableConfig::ColumnConfigcolumns () const
 Gets the list with all columns and their configuration.
int columnWidth (int column) const
 Returns the width of a column, or -1 if column should use default width.
bool hasSameColumns (const QgsAttributeTableConfig &other) const
 Compare this configuration's columns name, type, and order to other.
bool isEmpty () const
 Returns true if the configuration is empty, ie it contains no columns.
int mapVisibleColumnToIndex (int visibleColumn) const
 Maps a visible column index to its original column index.
bool operator!= (const QgsAttributeTableConfig &other) const
void readXml (const QDomNode &node)
 Deserialize to XML on layer load.
void setActionWidgetStyle (ActionWidgetStyle actionWidgetStyle)
 Set the style of the action widget.
void setActionWidgetVisible (bool visible)
 Set if the action widget is visible.
void setColumnHidden (int column, bool hidden)
 Sets whether the specified column should be hidden.
void setColumns (const QVector< QgsAttributeTableConfig::ColumnConfig > &columns)
 Set the list of columns visible in the attribute table.
void setColumnWidth (int column, int width)
 Sets the width of a column.
void setSortExpression (const QString &sortExpression)
 Set the sort expression used for sorting.
void setSortOrder (Qt::SortOrder sortOrder)
 Set the sort order.
int size () const
 Returns the number of columns in the configuration.
QString sortExpression () const
 Gets the expression used for sorting.
Qt::SortOrder sortOrder () const
 Gets the sort order.
void update (const QgsFields &fields)
 Update the configuration with the given fields.
void writeXml (QDomNode &node) const
 Serialize to XML on layer save.

Detailed Description

A container for configuration of the attribute table.

The configuration is specific for one vector layer.

Definition at line 35 of file qgsattributetableconfig.h.

Member Enumeration Documentation

◆ ActionWidgetStyle

The style of the action widget in the attribute table.

Enumerator
ButtonList 

A list of buttons.

DropDown 

A tool button with a drop-down to select the current action.

Definition at line 74 of file qgsattributetableconfig.h.

◆ Type

The type of an attribute table column.

Enumerator
Field 

This column represents a field.

Action 

This column represents an action widget.

Definition at line 42 of file qgsattributetableconfig.h.

Constructor & Destructor Documentation

◆ QgsAttributeTableConfig()

QgsAttributeTableConfig::QgsAttributeTableConfig ( )
default

Member Function Documentation

◆ actionWidgetStyle()

QgsAttributeTableConfig::ActionWidgetStyle QgsAttributeTableConfig::actionWidgetStyle ( ) const

Gets the style of the action widget.

Definition at line 135 of file qgsattributetableconfig.cpp.

◆ actionWidgetVisible()

bool QgsAttributeTableConfig::actionWidgetVisible ( ) const

Returns true if the action widget is visible.

Definition at line 113 of file qgsattributetableconfig.cpp.

◆ columnHidden()

bool QgsAttributeTableConfig::columnHidden ( int column) const

Returns true if the specified column is hidden.

Parameters
columncolumn index
See also
setColumnHidden()

Definition at line 231 of file qgsattributetableconfig.cpp.

◆ columns()

QVector< QgsAttributeTableConfig::ColumnConfig > QgsAttributeTableConfig::columns ( ) const

Gets the list with all columns and their configuration.

The list order defines the order of appearance.

Definition at line 22 of file qgsattributetableconfig.cpp.

◆ columnWidth()

int QgsAttributeTableConfig::columnWidth ( int column) const

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

Parameters
columncolumn index
See also
setColumnWidth()

Definition at line 221 of file qgsattributetableconfig.cpp.

◆ hasSameColumns()

bool QgsAttributeTableConfig::hasSameColumns ( const QgsAttributeTableConfig & other) const

Compare this configuration's columns name, type, and order to other.

The column's width is not considered.

Definition at line 301 of file qgsattributetableconfig.cpp.

◆ isEmpty()

bool QgsAttributeTableConfig::isEmpty ( ) const

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

See also
size()

Definition at line 27 of file qgsattributetableconfig.cpp.

◆ mapVisibleColumnToIndex()

int QgsAttributeTableConfig::mapVisibleColumnToIndex ( int visibleColumn) const

Maps a visible column index to its original column index.

Parameters
visibleColumnindex of visible column
Returns
corresponding index when hidden columns are considered

Definition at line 37 of file qgsattributetableconfig.cpp.

◆ operator!=()

bool QgsAttributeTableConfig::operator!= ( const QgsAttributeTableConfig & other) const

Definition at line 241 of file qgsattributetableconfig.cpp.

◆ readXml()

void QgsAttributeTableConfig::readXml ( const QDomNode & node)

Deserialize to XML on layer load.

Definition at line 146 of file qgsattributetableconfig.cpp.

◆ setActionWidgetStyle()

void QgsAttributeTableConfig::setActionWidgetStyle ( ActionWidgetStyle actionWidgetStyle)

Set the style of the action widget.

Definition at line 140 of file qgsattributetableconfig.cpp.

◆ setActionWidgetVisible()

void QgsAttributeTableConfig::setActionWidgetVisible ( bool visible)

Set if the action widget is visible.

Definition at line 124 of file qgsattributetableconfig.cpp.

◆ setColumnHidden()

void QgsAttributeTableConfig::setColumnHidden ( int column,
bool hidden )

Sets whether the specified column should be hidden.

Parameters
columncolumn index
hiddenset to true to hide column
See also
columnHidden()

Definition at line 236 of file qgsattributetableconfig.cpp.

◆ setColumns()

void QgsAttributeTableConfig::setColumns ( const QVector< QgsAttributeTableConfig::ColumnConfig > & columns)

Set the list of columns visible in the attribute table.

The list order defines the order of appearance.

Definition at line 52 of file qgsattributetableconfig.cpp.

◆ setColumnWidth()

void QgsAttributeTableConfig::setColumnWidth ( int column,
int width )

Sets the width of a column.

Parameters
columncolumn index
widthcolumn width in pixels, or -1 if column should use default width
See also
columnWidth()

Definition at line 226 of file qgsattributetableconfig.cpp.

◆ setSortExpression()

void QgsAttributeTableConfig::setSortExpression ( const QString & sortExpression)

Set the sort expression used for sorting.

Definition at line 216 of file qgsattributetableconfig.cpp.

◆ setSortOrder()

void QgsAttributeTableConfig::setSortOrder ( Qt::SortOrder sortOrder)

Set the sort order.

Definition at line 251 of file qgsattributetableconfig.cpp.

◆ size()

int QgsAttributeTableConfig::size ( ) const

Returns the number of columns in the configuration.

Since
QGIS 3.22

Definition at line 32 of file qgsattributetableconfig.cpp.

◆ sortExpression()

QString QgsAttributeTableConfig::sortExpression ( ) const

Gets the expression used for sorting.

Definition at line 211 of file qgsattributetableconfig.cpp.

◆ sortOrder()

Qt::SortOrder QgsAttributeTableConfig::sortOrder ( ) const

Gets the sort order.

Definition at line 246 of file qgsattributetableconfig.cpp.

◆ update()

void QgsAttributeTableConfig::update ( const QgsFields & fields)

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.

Definition at line 57 of file qgsattributetableconfig.cpp.

◆ writeXml()

void QgsAttributeTableConfig::writeXml ( QDomNode & node) const

Serialize to XML on layer save.

Definition at line 262 of file qgsattributetableconfig.cpp.


The documentation for this class was generated from the following files: