QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
17 #include <QMessageBox>
46 : QDialog( parent, flags )
61 const auto constColumns = mConfig.
columns();
64 QListWidgetItem *item =
nullptr;
67 item =
new QListWidgetItem( tr(
"[Action Widget]" ), mFieldsList );
91 item->setCheckState( columnConfig.hidden ? Qt::Unchecked : Qt::Checked );
92 item->setData( Qt::UserRole, QVariant::fromValue( columnConfig ) );
96 if ( !vl || mConfig.
columns().count() < 7 )
98 mShowAllButton->hide();
99 mHideAllButton->hide();
105 : QgsOrganizeTableColumnsDialog( vl, vl->attributeTableConfig(), parent, flags )
112 QVector<QgsAttributeTableConfig::ColumnConfig> columns;
113 columns.reserve( mFieldsList->count() );
115 for (
int i = 0; i < mFieldsList->count() ; i++ )
117 const QListWidgetItem *item = mFieldsList->item( i );
120 columnConfig.
hidden = item->checkState() == Qt::Unchecked;
122 columns.append( columnConfig );
132 for (
int i = 0; i < mFieldsList->count() ; i++ )
134 mFieldsList->item( i )->setCheckState( Qt::Checked );
140 for (
int i = 0; i < mFieldsList->count() ; i++ )
142 mFieldsList->item( i )->setCheckState( Qt::Unchecked );
QgsAttributeTableConfig config() const
Gets the updated configuration.
QgsOrganizeTableColumnsDialog(const QgsVectorLayer *vl, const QgsAttributeTableConfig &config, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::Window)
Constructor.
Defines the configuration of a column in the attribute table.
void hideAll()
hideAll unchecks all the fields to hide them all in the attribute table
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...
This is a container for configuration of the attribute table. The configuration is specific for one v...
QgsFields fields() const FINAL
Returns the list of fields of this layer.
void showAll()
showAll checks all the fields to show them all in the attribute table
@ Action
This column represents an action widget.
QVector< QgsAttributeTableConfig::ColumnConfig > columns() const
Gets the list with all columns and their configuration.
FieldOrigin fieldOrigin(int fieldIdx) const
Returns the field's origin (value from an enumeration).
void setColumns(const QVector< QgsAttributeTableConfig::ColumnConfig > &columns)
Set the list of columns visible in the attribute table.
@ OriginExpression
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.
Represents a vector layer which manages a vector based data sets.
bool hidden
Flag that controls if the column is hidden.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
@ OriginJoin
Field comes from a joined layer (originIndex / 1000 = index of the join, originIndex % 1000 = index w...
void update(const QgsFields &fields)
Update the configuration with the given fields.