Skip to content

Commit

Permalink
Add a right click action to edit virtual layer settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Mercier committed Mar 23, 2016
1 parent ee81c6b commit d87c381
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/app/qgsapplayertreeviewmenuprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ QMenu* QgsAppLayerTreeViewMenuProvider::createContextMenu()

if ( mView->selectedNodes( true ).count() >= 2 )
menu->addAction( actions->actionGroupSelected( menu ) );

if ( layer && layer->type() == QgsMapLayer::VectorLayer && static_cast<QgsVectorLayer*>( layer )->providerType() == "virtual" )
{
menu->addAction( tr( "Edit virtual layer settings" ), QgisApp::instance(), SLOT( addVirtualLayer() ) );
}
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/providers/virtual/qgsvirtuallayerprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ bool QgsVirtualLayerProvider::createIt()
continue;

const QgsVectorLayer* vl = static_cast<const QgsVectorLayer*>( l );
if (( vl->name() == tname ) || ( vl->id() == tname ) )
if ( ( vl->name() == tname ) || ( vl->name().toLower() == tname.toLower() ) || ( vl->id() == tname ) )
{
mDefinition.addSource( tname, vl->id() );
found = true;
Expand Down

0 comments on commit d87c381

Please sign in to comment.