Skip to content
Permalink
Browse files

delete selected layers on spatialite and pg

  • Loading branch information
signedav committed Nov 15, 2018
1 parent be0ce0c commit 7acd83fd09f1b526cfd4a993c430d8187fb6e245
@@ -317,8 +317,18 @@ QList<QAction *> QgsPGLayerItem::actions( QWidget *parent )
connect( actionRenameLayer, &QAction::triggered, this, &QgsPGLayerItem::renameLayer );
lst.append( actionRenameLayer );

QAction *actionDeleteLayer = new QAction( tr( "Delete %1" ).arg( typeName ), parent );
connect( actionDeleteLayer, &QAction::triggered, this, &QgsPGLayerItem::deleteLayer );
const QString deleteText = selectedItems().count() == 1 ? tr( "Delete %1" ).arg( typeName )
: tr( "Delete Selected Tables" );
QAction *actionDeleteLayer = new QAction( deleteText, parent );
connect( actionDeleteLayer, &QAction::triggered, this, [ = ]
{
QList<QgsDataItem *> items = selectedItems();
for ( QgsDataItem *item : items )
{
if ( QgsPGLayerItem *pgLayerItem = qobject_cast< QgsPGLayerItem *>( item ) )
pgLayerItem->deleteLayer();
}
} ) ;
lst.append( actionDeleteLayer );

if ( !mLayerProperty.isView )
@@ -45,8 +45,19 @@ QList<QAction *> QgsSLLayerItem::actions( QWidget *parent )
{
QList<QAction *> lst;

QAction *actionDeleteLayer = new QAction( tr( "Delete Layer" ), parent );
connect( actionDeleteLayer, &QAction::triggered, this, &QgsSLLayerItem::deleteLayer );
const QString deleteText = selectedItems().count() == 1 ? tr( "Delete Layer '%1'…" ).arg( mName )
: tr( "Delete Selected Layers" );
QAction *actionDeleteLayer = new QAction( deleteText, parent );

connect( actionDeleteLayer, &QAction::triggered, this, [ = ]
{
QList<QgsDataItem *> items = selectedItems();
for ( QgsDataItem *item : items )
{
if ( QgsSLLayerItem *slLayerItem = qobject_cast< QgsSLLayerItem *>( item ) )
slLayerItem->deleteLayer();
}
} ) ;
lst.append( actionDeleteLayer );

return lst;

0 comments on commit 7acd83f

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