17 #include <QMessageBox> 46 : QDialog( parent, flags )
63 QListWidgetItem *item =
nullptr;
66 item =
new QListWidgetItem( tr(
"[Action Widget]" ), mFieldsList );
90 item->setCheckState( columnConfig.
hidden ? Qt::Unchecked : Qt::Checked );
91 item->setData( Qt::UserRole, QVariant::fromValue( columnConfig ) );
95 if ( !vl || mConfig.
columns().count() < 7 )
97 mShowAllButton->hide();
98 mHideAllButton->hide();
109 QVector<QgsAttributeTableConfig::ColumnConfig> columns;
110 columns.reserve( mFieldsList->count() );
112 for (
int i = 0; i < mFieldsList->count() ; i++ )
114 const QListWidgetItem *item = mFieldsList->item( i );
117 columnConfig.
hidden = item->checkState() == Qt::Unchecked;
119 columns.append( columnConfig );
129 for (
int i = 0; i < mFieldsList->count() ; i++ )
131 mFieldsList->item( i )->setCheckState( Qt::Checked );
137 for (
int i = 0; i < mFieldsList->count() ; i++ )
139 mFieldsList->item( i )->setCheckState( Qt::Unchecked );
QgsAttributeTableConfig::Type type
The type of this column.
void update(const QgsFields &fields)
Update the configuration with the given fields.
Field comes from a joined layer (originIndex / 1000 = index of the join, originIndex % 1000 = index w...
QgsAttributeTableConfig config() const
Gets the updated configuration.
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
This column represents an action widget.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
Dialog for organising (hiding and reordering) columns in the attributes table.
void hideAll()
hideAll unchecks all the fields to hide them all in the attribute table
QgsOrganizeTableColumnsDialog(const QgsVectorLayer *vl, QgsAttributeTableConfig config, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::Window)
Constructor.
bool hidden
Flag that controls if the column is hidden.
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
void showAll()
showAll checks all the fields to show them all in the attribute table
QString name
The name of the attribute if this column represents a field.
QString attributeDisplayName(int index) const
Convenience function that returns the attribute alias if defined or the field name else...
QVector< QgsAttributeTableConfig::ColumnConfig > columns() const
Gets the list with all columns and their configuration.
void setColumns(const QVector< QgsAttributeTableConfig::ColumnConfig > &columns)
Set the list of columns visible in the attribute table.
FieldOrigin fieldOrigin(int fieldIdx) const
Gets field's origin (value from an enumeration)
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
Defines the configuration of a column in the attribute table.
This is a container for configuration of the attribute table.
Represents a vector layer which manages a vector based data sets.
Field is calculated from an expression.