17 #include <QMessageBox> 28 #include "qgsexpression.h" 44 : QDialog( parent, flags )
60 QListWidgetItem *item =
nullptr;
63 item =
new QListWidgetItem( tr(
"[Action Widget]" ), mFieldsList );
87 item->setCheckState( columnConfig.
hidden ? Qt::Unchecked : Qt::Checked );
88 item->setData( Qt::UserRole, QVariant::fromValue( columnConfig ) );
92 if ( !vl || mConfig.
columns().count() < 7 )
94 mShowAllButton->hide();
95 mHideAllButton->hide();
99 restoreGeometry( settings.
value( QStringLiteral(
"Windows/QgsOrganizeTableColumnsDialog/geometry" ) ).toByteArray() );
105 settings.
setValue( QStringLiteral(
"Windows/QgsOrganizeTableColumnsDialog/geometry" ),
saveGeometry() );
110 QVector<QgsAttributeTableConfig::ColumnConfig> columns;
111 columns.reserve( mFieldsList->count() );
113 for (
int i = 0; i < mFieldsList->count() ; i++ )
115 const QListWidgetItem *item = mFieldsList->item( i );
118 columnConfig.
hidden = item->checkState() == Qt::Unchecked;
120 columns.append( columnConfig );
130 for (
int i = 0; i < mFieldsList->count() ; i++ )
132 mFieldsList->item( i )->setCheckState( Qt::Checked );
138 for (
int i = 0; i < mFieldsList->count() ; i++ )
140 mFieldsList->item( i )->setCheckState( Qt::Unchecked );
int lookupField(const QString &fieldName) const
Look up field's index from the field name.
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...
FieldOrigin fieldOrigin(int fieldIdx) const
Get field's origin (value from an enumeration)
QgsAttributeTableConfig config() const
Get the updated configuration.
This class is a composition of two QSettings instances:
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
This column represents an action widget.
void saveGeometry(QWidget *widget, const QString &keyName)
Save the wigget geometry into settings.
bool restoreGeometry(QWidget *widget, const QString &keyName)
Restore the wigget geometry from settings.
void setValue(const QString &key, const QVariant &value, const QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
QgsFields fields() const override
Returns the list of fields of this layer.
void hideAll()
hideAll unchecks all the fields to hide them all in the attribute table
bool hidden
Flag that controls if the column is hidden.
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.
~QgsOrganizeTableColumnsDialog() override
QVector< QgsAttributeTableConfig::ColumnConfig > columns() const
Get the list with all columns and their configuration.
QgsAttributeTableConfig attributeTableConfig() const
Get the attribute table configuration object.
void setColumns(const QVector< QgsAttributeTableConfig::ColumnConfig > &columns)
Set the list of columns visible in the attribute table.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), const Section section=NoSection) const
Returns the value for setting key.
Defines the configuration of a column in the attribute table.
This is a container for configuration of the attribute table.
QgsOrganizeTableColumnsDialog(const QgsVectorLayer *vl, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::Window)
Constructor.
Represents a vector layer which manages a vector based data sets.
Field is calculated from an expression.
QString attributeDisplayName(int index) const
Convenience function that returns the attribute alias if defined or the field name else...