@@ -378,7 +378,10 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
378
378
QTreeWidgetItem *featItem = featureItem ( item );
379
379
if ( featItem )
380
380
{
381
- mActionPopup ->addAction ( vlayer->isEditable () ? tr ( " Edit feature form" ) : tr ( " View feature form" ), this , SLOT ( featureForm () ) );
381
+ mActionPopup ->addAction (
382
+ QgisApp::getThemeIcon ( vlayer->isEditable () ? " /mIconEditable.png" : " /mIconEditable.png" ),
383
+ vlayer->isEditable () ? tr ( " Edit feature form" ) : tr ( " View feature form" ),
384
+ this , SLOT ( featureForm () ) );
382
385
mActionPopup ->addAction ( tr ( " Zoom to feature" ), this , SLOT ( zoomToFeature () ) );
383
386
mActionPopup ->addAction ( tr ( " Copy attribute value" ), this , SLOT ( copyAttributeValue () ) );
384
387
mActionPopup ->addAction ( tr ( " Copy feature attributes" ), this , SLOT ( copyFeatureAttributes () ) );
@@ -393,26 +396,23 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
393
396
mActionPopup ->addAction ( tr ( " Expand all" ), this , SLOT ( expandAll () ) );
394
397
mActionPopup ->addAction ( tr ( " Collapse all" ), this , SLOT ( collapseAll () ) );
395
398
396
- if ( vlayer->actions ()->size () > 0 )
399
+ if ( featItem && vlayer->actions ()->size () > 0 )
397
400
{
398
401
mActionPopup ->addSeparator ();
399
402
400
403
// The assumption is made that an instance of QgsIdentifyResults is
401
404
// created for each new Identify Results dialog box, and that the
402
405
// contents of the popup menu doesn't change during the time that
403
406
// such a dialog box is around.
404
- QAction *a = mActionPopup ->addAction ( tr ( " Run action" ) );
405
- a->setEnabled ( false );
406
-
407
407
for ( int i = 0 ; i < vlayer->actions ()->size (); i++ )
408
408
{
409
409
const QgsAction &action = vlayer->actions ()->at ( i );
410
410
411
411
if ( !action.runable () )
412
412
continue ;
413
413
414
- QgsFeatureAction *a = new QgsFeatureAction ( action.name (), this , vlayer, i, featureItem ( item ) );
415
- mActionPopup ->addAction ( action.name (), a, SLOT ( execute () ) );
414
+ QgsFeatureAction *a = new QgsFeatureAction ( action.name (), this , vlayer, i, featItem );
415
+ mActionPopup ->addAction ( QgisApp::getThemeIcon ( " /mAction.png " ), action.name (), a, SLOT ( execute () ) );
416
416
}
417
417
}
418
418
@@ -525,6 +525,9 @@ void QgsIdentifyResults::doAction( QTreeWidgetItem *item, int action )
525
525
526
526
QTreeWidgetItem *QgsIdentifyResults::featureItem ( QTreeWidgetItem *item )
527
527
{
528
+ if ( !item )
529
+ return 0 ;
530
+
528
531
QTreeWidgetItem *featItem;
529
532
if ( item->parent () )
530
533
{
0 commit comments