Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[feature] New configuration options for attribute table
* Allow reordering the attribute table columns * Allow adding a new column to trigger an action to the attribute table
- Loading branch information
Showing
27 changed files
with
738 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/*************************************************************************** | ||
qgsattributetableconfig.h - QgsAttributeTableConfig | ||
|
||
--------------------- | ||
begin : 27.4.2016 | ||
copyright : (C) 2016 by Matthias Kuhn | ||
email : matthias@opengis.ch | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
/** | ||
* This is a container for configuration of the attribute table. | ||
* The configuration is specific for one vector layer. | ||
*/ | ||
|
||
class QgsAttributeTableConfig | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsattributetableconfig.h> | ||
%End | ||
public: | ||
/** | ||
* The type of an attribute table column. | ||
*/ | ||
enum Type | ||
{ | ||
Field, //!< This column represents a field | ||
Action //!< This column represents an action widget | ||
}; | ||
|
||
/** | ||
* Defines the configuration of a column in the attribute table. | ||
*/ | ||
struct ColumnConfig | ||
{ | ||
QgsAttributeTableConfig::Type mType; //!< The type of this column. | ||
QString mName; //!< The name of the attribute if this column represents a field | ||
bool mHidden; //!< Flag that controls if the column is hidden | ||
}; | ||
|
||
QgsAttributeTableConfig(); | ||
|
||
/** | ||
* Get the list with all columns and their configuration. | ||
* The list order defines the order of appearance. | ||
*/ | ||
QVector<QgsAttributeTableConfig::ColumnConfig> columns() const; | ||
|
||
/** | ||
* Set the list of columns visible in the attribute table. | ||
* The list order defines the order of appearance. | ||
*/ | ||
void setColumns( const QVector<QgsAttributeTableConfig::ColumnConfig>& columns ); | ||
|
||
/** | ||
* 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. | ||
*/ | ||
void update( const QgsFields& fields ); | ||
|
||
/** | ||
* Serialize to XML on layer save | ||
*/ | ||
void writeXml( QDomNode& node ) const; | ||
|
||
/** | ||
* Deserialize to XML on layer load | ||
*/ | ||
void readXml( const QDomNode& node ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.