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 2898295 commit da0208b7d4a10f5fe42212fc9c9ff98bbfa3f062
Showing with 31 additions and 0 deletions.
  1. +16 −0 src/app/qgsattributetabledialog.cpp
  2. +5 −0 src/app/qgsattributetabledialog.h
  3. +10 −0 src/ui/qgsattributetabledialog.ui
@@ -54,6 +54,7 @@
#include "qgsguiutils.h"
#include "qgsproxyprogresstask.h"
#include "qgisapp.h"
#include "qgsorganizetablecolumnsdialog.h"

QgsExpressionContext QgsAttributeTableDialog::createExpressionContext() const
{
@@ -105,6 +106,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 );
@@ -832,6 +834,20 @@ void QgsAttributeTableDialog::mActionRemoveAttribute_triggered()
}
}

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()
{
@@ -153,6 +153,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
@@ -208,6 +208,7 @@
<addaction name="separator"/>
<addaction name="mActionAddAttribute"/>
<addaction name="mActionRemoveAttribute"/>
<addaction name="mActionOrganizeColumns"/>
<addaction name="mActionOpenFieldCalculator"/>
<addaction name="separator"/>
<addaction name="mActionSetStyles"/>
@@ -534,6 +535,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>
</widget>
<customwidgets>
<customwidget>

0 comments on commit da0208b

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