@@ -571,16 +571,15 @@ void QgsDualView::viewWillShowContextMenu( QMenu *menu, const QModelIndex &atInd
571
571
if ( !action.runable () )
572
572
continue ;
573
573
574
- if ( vl->readOnly () && action.isEnabledOnlyWhenEditable () )
574
+ if ( ! vl->isEditable () && action.isEnabledOnlyWhenEditable () )
575
575
continue ;
576
576
577
577
QgsAttributeTableAction *a = new QgsAttributeTableAction ( action.name (), this , action.id (), sourceIndex );
578
578
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
579
- QAction *ma = menu->addAction ( action.name (), a, SLOT ( execute () ) );
579
+ menu->addAction ( action.name (), a, SLOT ( execute () ) );
580
580
#else
581
- QAction *ma = menu->addAction ( action.name (), a, &QgsAttributeTableAction::execute );
581
+ menu->addAction ( action.name (), a, &QgsAttributeTableAction::execute );
582
582
#endif
583
- ma->setEnabled ( !action.isEnabledOnlyWhenEditable () || vl->isEditable () );
584
583
}
585
584
}
586
585
@@ -593,16 +592,15 @@ void QgsDualView::viewWillShowContextMenu( QMenu *menu, const QModelIndex &atInd
593
592
594
593
Q_FOREACH ( QgsMapLayerAction *action, registeredActions )
595
594
{
596
- if ( vl->readOnly () && action->isEnabledOnlyWhenEditable () )
595
+ if ( ! vl->isEditable () && action->isEnabledOnlyWhenEditable () )
597
596
continue ;
598
597
599
598
QgsAttributeTableMapLayerAction *a = new QgsAttributeTableMapLayerAction ( action->text (), this , action, sourceIndex );
600
599
#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
601
- QAction *ma = menu->addAction ( action->text (), a, SLOT ( execut () ) );
600
+ menu->addAction ( action->text (), a, SLOT ( execut () ) );
602
601
#else
603
- QAction *ma = menu->addAction ( action->text (), a, &QgsAttributeTableMapLayerAction::execute );
602
+ menu->addAction ( action->text (), a, &QgsAttributeTableMapLayerAction::execute );
604
603
#endif
605
- ma->setEnabled ( !action->isEnabledOnlyWhenEditable () || vl->isEditable () );
606
604
}
607
605
}
608
606
0 commit comments