Skip to content

Commit

Permalink
respect attribute table behavior settings
Browse files Browse the repository at this point in the history
Fixes undocumented bug of attribute table settings (Show features Visible on Map etc.)
not being respected. The settings were saved correctly but QGIS didn't make use of them.

(cherry picked from commit f4aa9a4)
  • Loading branch information
tudorbarascu authored and nyalldawson committed Jan 6, 2019
1 parent a1ea800 commit 06f6965
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -571,8 +571,12 @@ void QgisApp::layerTreeViewDoubleClicked( const QModelIndex &index )
break;
}
case 1:
QgisApp::instance()->attributeTable();
{
QgsSettings settings;
QgsAttributeTableFilterModel::FilterMode initialMode = settings.enumValue( QStringLiteral( "qgis/attributeTableBehavior" ), QgsAttributeTableFilterModel::ShowAll );
QgisApp::instance()->attributeTable( initialMode );
break;
}
case 2:
mapStyleDock( true );
break;
Expand Down
6 changes: 4 additions & 2 deletions src/app/qgsapplayertreeviewmenuprovider.cpp
Expand Up @@ -206,8 +206,10 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
QAction *allEditsAction = QgisApp::instance()->actionAllEdits();

// attribute table
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionOpenTable.svg" ) ), tr( "&Open Attribute Table" ),
QgisApp::instance(), SLOT( attributeTable() ) );
QgsSettings settings;
QgsAttributeTableFilterModel::FilterMode initialMode = settings.enumValue( QStringLiteral( "qgis/attributeTableBehavior" ), QgsAttributeTableFilterModel::ShowAll );
QAction *attrTableAction = menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionOpenTable.svg" ) ), tr( "&Open Attribute Table" ) );
connect( attrTableAction, &QAction::triggered, QgisApp::instance(), [ = ] { QgisApp::instance()->attributeTable( initialMode ); } );

// allow editing
int cap = vlayer->dataProvider()->capabilities();
Expand Down

0 comments on commit 06f6965

Please sign in to comment.