Skip to content

Commit

Permalink
Move change data source under filter
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Nov 8, 2018
1 parent c74ce88 commit ba4981a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/app/qgsapplayertreeviewmenuprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,26 +199,6 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()

menu->addSeparator();

// change data source is only supported for vectors and rasters
if ( ( vlayer || rlayer ) )
{

QAction *a = new QAction( tr( "Change data source…" ), menu );
if ( layer->isEditable() )
{
a->setEnabled( false );
}
else
{
connect( a, &QAction::triggered, [ = ]
{
QgisApp::instance()->changeDataSource( layer );
} );
}
menu->addAction( a );
// Disable when layer is editable
}

if ( vlayer )
{
QAction *toggleEditingAction = QgisApp::instance()->actionToggleEditing();
Expand Down Expand Up @@ -259,6 +239,26 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
}
}

// change data source is only supported for vectors and rasters
if ( vlayer || rlayer )
{

QAction *a = new QAction( tr( "Change data source…" ), menu );
// Disable when layer is editable
if ( layer->isEditable() )
{
a->setEnabled( false );
}
else
{
connect( a, &QAction::triggered, [ = ]
{
QgisApp::instance()->changeDataSource( layer );
} );
}
menu->addAction( a );
}

menu->addSeparator();

if ( layer && layer->isSpatial() )
Expand Down
Binary file modified tests/testdata/projects/bad_layers_test.gpkg
Binary file not shown.

0 comments on commit ba4981a

Please sign in to comment.