QGIS API Documentation  2.18.3-Las Palmas (77b8c3d)
Classes | Public Types | Public Member Functions | List of all members
QgsAttributeTableConfig Class Reference

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

Detailed Description

This is a container for configuration of the attribute table.

The configuration is specific for one vector layer.

Note
added in QGIS 2.16

Definition at line 31 of file qgsattributetableconfig.h.

Member Enumeration Documentation

The style of the action widget in the attribute table.

Enumerator
ButtonList 

A list of buttons.

DropDown 

A tool button with a dropdown to select the current action.

Definition at line 66 of file qgsattributetableconfig.h.

The type of an attribute table column.

Enumerator
Field 

This column represents a field.

Action 

This column represents an action widget.

Definition at line 37 of file qgsattributetableconfig.h.

Constructor & Destructor Documentation

QgsAttributeTableConfig::QgsAttributeTableConfig ( )

Definition at line 20 of file qgsattributetableconfig.cpp.

Member Function Documentation

QgsAttributeTableConfig::ActionWidgetStyle QgsAttributeTableConfig::actionWidgetStyle ( ) const

Get the style of the action widget.

Definition at line 127 of file qgsattributetableconfig.cpp.

bool QgsAttributeTableConfig::actionWidgetVisible ( ) const

Returns true if the action widget is visible.

Definition at line 106 of file qgsattributetableconfig.cpp.

bool QgsAttributeTableConfig::columnHidden ( int  column) const

Returns true if the specified column is hidden.

Parameters
columncolumn index
See also
setColumnHidden()

Definition at line 222 of file qgsattributetableconfig.cpp.

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

Get the list with all columns and their configuration.

The list order defines the order of appearance.

Definition at line 26 of file qgsattributetableconfig.cpp.

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 212 of file qgsattributetableconfig.cpp.

bool QgsAttributeTableConfig::isEmpty ( ) const

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

Definition at line 31 of file qgsattributetableconfig.cpp.

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 36 of file qgsattributetableconfig.cpp.

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

Compare this configuration to other.

Definition at line 232 of file qgsattributetableconfig.cpp.

void QgsAttributeTableConfig::readXml ( const QDomNode node)

Deserialize to XML on layer load.

Definition at line 138 of file qgsattributetableconfig.cpp.

void QgsAttributeTableConfig::setActionWidgetStyle ( const ActionWidgetStyle actionWidgetStyle)

Set the style of the action widget.

Definition at line 132 of file qgsattributetableconfig.cpp.

void QgsAttributeTableConfig::setActionWidgetVisible ( bool  visible)

Set if the action widget is visible.

Definition at line 116 of file qgsattributetableconfig.cpp.

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 227 of file qgsattributetableconfig.cpp.

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

Set the list of columns visible in the attribute table.

The list order defines the order of appearance.

Definition at line 51 of file qgsattributetableconfig.cpp.

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 217 of file qgsattributetableconfig.cpp.

void QgsAttributeTableConfig::setSortExpression ( const QString sortExpression)

Set the sort expression used for sorting.

Definition at line 207 of file qgsattributetableconfig.cpp.

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

Set the sort order.

Note
Added in 2.16

Definition at line 242 of file qgsattributetableconfig.cpp.

QString QgsAttributeTableConfig::sortExpression ( ) const

Get the expression used for sorting.

Definition at line 202 of file qgsattributetableconfig.cpp.

Qt::SortOrder QgsAttributeTableConfig::sortOrder ( ) const

Get the sort order.

Note
Added in 2.16

Definition at line 237 of file qgsattributetableconfig.cpp.

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 56 of file qgsattributetableconfig.cpp.

void QgsAttributeTableConfig::writeXml ( QDomNode node) const

Serialize to XML on layer save.

Definition at line 247 of file qgsattributetableconfig.cpp.


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