File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -200,15 +200,23 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
200
200
menu->addSeparator ();
201
201
202
202
// change data source is only supported for vectors and rasters
203
- if ( vlayer || rlayer )
203
+ if ( ( vlayer || rlayer ) )
204
204
{
205
205
206
206
QAction *a = new QAction ( tr ( " Change data source…" ), menu );
207
- connect ( a, &QAction::triggered, [ = ]
207
+ if ( layer-> isEditable () )
208
208
{
209
- QgisApp::instance ()->changeDataSource ( layer );
210
- } );
209
+ a->setEnabled ( false );
210
+ }
211
+ else
212
+ {
213
+ connect ( a, &QAction::triggered, [ = ]
214
+ {
215
+ QgisApp::instance ()->changeDataSource ( layer );
216
+ } );
217
+ }
211
218
menu->addAction ( a );
219
+ // Disable when layer is editable
212
220
}
213
221
214
222
if ( vlayer )
You can’t perform that action at this time.
0 commit comments