@@ -5576,6 +5576,9 @@ void QgisApp::updateDefaultFeatureAction( QAction *action )
5576
5576
if ( !vlayer )
5577
5577
return ;
5578
5578
5579
+ mActionFeatureAction ->setIcon ( QgsApplication::getThemeIcon ( " /mAction.svg" ) );
5580
+ mActionFeatureAction ->setToolTip ( tr ( " No action selected" ) );
5581
+
5579
5582
mFeatureActionMenu ->setActiveAction ( action );
5580
5583
5581
5584
int index = mFeatureActionMenu ->actions ().indexOf ( action );
@@ -5584,6 +5587,16 @@ void QgisApp::updateDefaultFeatureAction( QAction *action )
5584
5587
{
5585
5588
vlayer->actions ()->setDefaultAction ( index );
5586
5589
QgsMapLayerActionRegistry::instance ()->setDefaultActionForLayer ( vlayer, nullptr );
5590
+
5591
+ QgsAction a = vlayer->actions ()->listActions ().at ( index );
5592
+
5593
+ if ( !a.name ().isEmpty () )
5594
+ mActionFeatureAction ->setToolTip ( tr ( " Run feature action<br><b>%1</b>" ).arg ( a.name () ) );
5595
+ else if ( !a.shortTitle ().isEmpty () )
5596
+ mActionFeatureAction ->setToolTip ( tr ( " Run feature action<br><b>%1</b>" ).arg ( a.shortTitle () ) );
5597
+
5598
+ if ( !a.icon ().isNull () )
5599
+ mActionFeatureAction ->setIcon ( a.icon () );
5587
5600
}
5588
5601
else
5589
5602
{
@@ -5594,6 +5607,12 @@ void QgisApp::updateDefaultFeatureAction( QAction *action )
5594
5607
if ( mapLayerAction )
5595
5608
{
5596
5609
QgsMapLayerActionRegistry::instance ()->setDefaultActionForLayer ( vlayer, mapLayerAction );
5610
+
5611
+ if ( !mapLayerAction->text ().isEmpty () )
5612
+ mActionFeatureAction ->setToolTip ( tr ( " Run feature action<br><b>%1</b>" ).arg ( mapLayerAction->text () ) );
5613
+
5614
+ if ( !mapLayerAction->icon ().isNull () )
5615
+ mActionFeatureAction ->setIcon ( mapLayerAction->icon () );
5597
5616
}
5598
5617
else
5599
5618
{
@@ -5613,7 +5632,7 @@ void QgisApp::refreshFeatureActions()
5613
5632
QgsActionManager *actions = vlayer->actions ();
5614
5633
for ( int i = 0 ; i < actions->size (); i++ )
5615
5634
{
5616
- QAction *action = mFeatureActionMenu ->addAction ( actions->at ( i ).name () );
5635
+ QAction *action = mFeatureActionMenu ->addAction ( actions->at ( i ).icon (), actions-> at ( i ). name () );
5617
5636
if ( i == actions->defaultAction () )
5618
5637
{
5619
5638
mFeatureActionMenu ->setActiveAction ( action );
@@ -5637,6 +5656,7 @@ void QgisApp::refreshFeatureActions()
5637
5656
}
5638
5657
}
5639
5658
5659
+ updateDefaultFeatureAction ( mFeatureActionMenu ->activeAction () );
5640
5660
}
5641
5661
5642
5662
void QgisApp::measure ()
@@ -10700,6 +10720,8 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
10700
10720
}
10701
10721
}
10702
10722
}
10723
+
10724
+ refreshFeatureActions ();
10703
10725
}
10704
10726
10705
10727
void QgisApp::refreshActionFeatureAction ()
0 commit comments