18 #include <QStringList>    21     : mActionWidgetStyle( DropDown )
    33   return mColumns.isEmpty();
    38   for ( 
int i = 0; i < mColumns.size(); ++i )
    40     if ( mColumns.at( i ).hidden )
    45     if ( visibleColumn == i )
    60   bool containsActionColumn = 
false;
    62   for ( 
int i = mColumns.count() - 1; i >= 0; --i )
    78       containsActionColumn = 
true;
    82   Q_FOREACH ( 
const QgsField& field, fields )
    91       mColumns.append( newColumn );
    95   if ( !containsActionColumn )
   100     actionConfig.
hidden = 
true;
   102     mColumns.append( actionConfig );
   108   Q_FOREACH ( 
const ColumnConfig& columnConfig, mColumns )
   118   for ( 
int i = 0; i < mColumns.size(); ++i )
   120     if ( mColumns.at( i ).type == 
Action )
   122       mColumns[i].hidden = !visible;
   129   return mActionWidgetStyle;
   143   if ( !configNode.
isNull() )
   149     for ( 
int i = 0; i < columns.
size(); ++i )
   155       if ( columnElement.
attribute( 
"type" ) == 
"actions" )
   168       mColumns.append( column );
   182     for ( 
int i = 0; i < editTypeNodes.
size(); i++ )
   186       if ( editTypeElement.
attribute( 
"widgetv2type" ) == 
"Hidden" )
   193         mColumns.append( column );
   205   return mSortExpression;
   215   return mColumns.at( column ).width;
   220   mColumns[ column ].width = width;
   225   return mColumns.at( column ).hidden;
   230   mColumns[ column ].hidden = hidden;
   235   return mSortExpression != other.mSortExpression || mColumns != other.mColumns || mActionWidgetStyle != other.mActionWidgetStyle || mSortOrder != other.mSortOrder;
   246   if ( sortOrder != Qt::AscendingOrder && sortOrder != Qt::DescendingOrder )
   248     mSortOrder = Qt::AscendingOrder;
   260   QDomElement configElement  = doc.createElement( 
"attributetableconfig" );
   261   configElement.
setAttribute( 
"actionWidgetStyle", mActionWidgetStyle == 
ButtonList ? 
"buttonList" : 
"dropDown" );
   263   configElement.setAttribute( 
"sortExpression", mSortExpression );
   265   configElement.setAttribute( 
"sortOrder", mSortOrder );
   267   QDomElement columnsElement  = doc.createElement( 
"columns" );
   271     QDomElement columnElement = doc.createElement( 
"column" );
   296   return type == other.
type && name == other.
name && hidden == other.
hidden && width == other.
width;
 void setSortExpression(const QString &sortExpression)
Set the sort expression used for sorting. 
 
void update(const QgsFields &fields)
Update the configuration with the given fields. 
 
bool actionWidgetVisible() const
Returns true if the action widget is visible. 
 
void setSortOrder(const Qt::SortOrder &sortOrder)
Set the sort order. 
 
QDomNode appendChild(const QDomNode &newChild)
 
QString attribute(const QString &name, const QString &defValue) const
 
bool columnHidden(int column) const
Returns true if the specified column is hidden. 
 
bool contains(const QString &str, Qt::CaseSensitivity cs) const
 
int columnWidth(int column) const
Returns the width of a column, or -1 if column should use default width. 
 
Container of fields for a vector layer. 
 
This column represents an action widget. 
 
Type type
The type of this column. 
 
int mapVisibleColumnToIndex(int visibleColumn) const
Maps a visible column index to its original column index. 
 
double toDouble(bool *ok) const
 
QDomNodeList childNodes() const
 
ActionWidgetStyle
The style of the action widget in the attribute table. 
 
void setActionWidgetStyle(const ActionWidgetStyle &actionWidgetStyle)
Set the style of the action widget. 
 
QDomElement toElement() const
 
void setActionWidgetVisible(bool visible)
Set if the action widget is visible. 
 
void setColumnWidth(int column, int width)
Sets the width of a column. 
 
QString number(int n, int base)
 
ActionWidgetStyle actionWidgetStyle() const
Get the style of the action widget. 
 
void append(const T &value)
 
QDomDocument ownerDocument() const
 
void setAttribute(const QString &name, const QString &value)
 
int toInt(bool *ok, int base) const
 
bool hidden
Flag that controls if the column is hidden. 
 
bool operator==(const ColumnConfig &other) const
 
Encapsulate a field in an attribute table or data source. 
 
QString name
The name of the attribute if this column represents a field. 
 
QDomNode namedItem(const QString &name) const
 
void writeXml(QDomNode &node) const
Serialize to XML on layer save. 
 
QVector< ColumnConfig > columns() const
Get the list with all columns and their configuration. 
 
QgsAttributeTableConfig()
 
int width
Width of column, or -1 for default width. 
 
int indexFromName(const QString &name) const
Look up field's index from name. Returns -1 on error. 
 
bool isEmpty() const
Returns true if the configuration is empty, ie it contains no columns. 
 
A tool button with a dropdown to select the current action. 
 
void setColumnHidden(int column, bool hidden)
Sets whether the specified column should be hidden. 
 
This column represents a field. 
 
Defines the configuration of a column in the attribute table. 
 
bool operator!=(const QgsAttributeTableConfig &other) const
Compare this configuration to other. 
 
This is a container for configuration of the attribute table. 
 
Qt::SortOrder sortOrder() const
Get the sort order. 
 
QString sortExpression() const
Get the expression used for sorting. 
 
void readXml(const QDomNode &node)
Deserialize to XML on layer load. 
 
QDomNode at(int index) const
 
void setColumns(const QVector< ColumnConfig > &columns)
Set the list of columns visible in the attribute table.