Skip to content
Permalink
Browse files

Disable "Change data source..." action if layer is editable

  • Loading branch information
elpaso committed Nov 8, 2018
1 parent 85f8ba3 commit c74ce886dcfcf4a04c3fac82c79fa34c934886fa
@@ -200,15 +200,23 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
menu->addSeparator();

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

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

if ( vlayer )
Binary file not shown.

0 comments on commit c74ce88

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