Skip to content
Permalink
Browse files

add "Organize Columns" button to the attribute table toolbar to allow

unhiding columns if all of them were hidden by accident (fix #23397)
  • Loading branch information
alexbruy authored and nyalldawson committed Mar 13, 2020
1 parent 6d2817b commit 892d06c1b8ed264c46b53ed656126403075b48e8
Showing with 32 additions and 0 deletions.
  1. +17 −0 src/app/qgsattributetabledialog.cpp
  2. +5 −0 src/app/qgsattributetabledialog.h
  3. +10 −0 src/ui/qgsattributetabledialog.ui
@@ -58,6 +58,7 @@
#include "qgsproxyprogresstask.h"
#include "qgsstoredexpressionmanager.h"
#include "qgsdialog.h"
#include "qgsorganizetablecolumnsdialog.h"

QgsExpressionContext QgsAttributeTableDialog::createExpressionContext() const
{
@@ -109,6 +110,7 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *layer, QgsAttr
connect( mActionSelectedToTop, &QAction::toggled, this, &QgsAttributeTableDialog::mActionSelectedToTop_toggled );
connect( mActionAddAttribute, &QAction::triggered, this, &QgsAttributeTableDialog::mActionAddAttribute_triggered );
connect( mActionRemoveAttribute, &QAction::triggered, this, &QgsAttributeTableDialog::mActionRemoveAttribute_triggered );
connect( mActionOrganizeColumns, &QAction::triggered, this, &QgsAttributeTableDialog::mActionOrganizeColumns_triggered );
connect( mActionOpenFieldCalculator, &QAction::triggered, this, &QgsAttributeTableDialog::mActionOpenFieldCalculator_triggered );
connect( mActionDeleteSelected, &QAction::triggered, this, &QgsAttributeTableDialog::mActionDeleteSelected_triggered );
connect( mMainView, &QgsDualView::currentChanged, this, &QgsAttributeTableDialog::mMainView_currentChanged );
@@ -1107,6 +1109,21 @@ void QgsAttributeTableDialog::filterQueryAccepted()
filterQueryChanged( mFilterQuery->text() );
}

void QgsAttributeTableDialog::mActionOrganizeColumns_triggered()
{
if ( !mLayer )
{
return;
}

QgsOrganizeTableColumnsDialog dlg( mLayer, mLayer->attributeTableConfig(), this );
if ( dlg.exec() == QDialog::Accepted )
{
QgsAttributeTableConfig config = dlg.config();
mMainView->setAttributeTableConfig( config );
}
}

void QgsAttributeTableDialog::openConditionalStyles()
{
mMainView->openConditionalStyles();
@@ -154,6 +154,11 @@ class APP_EXPORT QgsAttributeTableDialog : public QDialog, private Ui::QgsAttrib
*/
void mActionDeleteSelected_triggered();

/**
* Opens organize columns dialog
*/
void mActionOrganizeColumns_triggered();

/**
* Called when the current index changes in the main view
* i.e. when the view mode is switched from table to form view
@@ -275,6 +275,7 @@
<addaction name="separator"/>
<addaction name="mActionAddAttribute"/>
<addaction name="mActionRemoveAttribute"/>
<addaction name="mActionOrganizeColumns"/>
<addaction name="mActionOpenFieldCalculator"/>
<addaction name="separator"/>
<addaction name="mActionSetStyles"/>
@@ -662,6 +663,15 @@
<string>Dock Attribute Table</string>
</property>
</action>
<action name="mActionOrganizeColumns">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionEditTable.svg</normaloff>:/images/themes/default/mActionEditTable.svg</iconset>
</property>
<property name="text">
<string>Organize Columns</string>
</property>
</action>
<action name="mActionStoredFilterExpressions">
<property name="icon">
<iconset resource="../../images/images.qrc">

0 comments on commit 892d06c

Please sign in to comment.
You can’t perform that action at this time.