@@ -418,6 +418,7 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
418418 if ( !item )
419419 return ;
420420
421+ int idx = 0 ;
421422 QgsVectorLayer *vlayer = vectorLayer ( item );
422423 if ( vlayer == 0 )
423424 return ;
@@ -438,6 +439,10 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
438439 mActionPopup ->addAction ( tr ( " Copy attribute value" ), this , SLOT ( copyAttributeValue () ) );
439440 mActionPopup ->addAction ( tr ( " Copy feature attributes" ), this , SLOT ( copyFeatureAttributes () ) );
440441 mActionPopup ->addSeparator ();
442+ if ( item->parent () == featItem && item->childCount () == 0 )
443+ {
444+ idx = item->data ( 0 , Qt::UserRole + 1 ).toInt ();
445+ }
441446 }
442447
443448 mActionPopup ->addAction ( tr ( " Clear results" ), this , SLOT ( clear () ) );
@@ -464,7 +469,7 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
464469 continue ;
465470
466471 int idx = featItem->data ( 0 , Qt::UserRole + 1 ).toInt ();
467- QgsFeatureAction *a = new QgsFeatureAction ( action.name (), mFeatures [ idx ], vlayer, i, this );
472+ QgsFeatureAction *a = new QgsFeatureAction ( action.name (), mFeatures [ idx ], vlayer, i, idx, this );
468473 mActionPopup ->addAction ( QgisApp::getThemeIcon ( " /mAction.png" ), action.name (), a, SLOT ( execute () ) );
469474 }
470475 }
@@ -877,7 +882,7 @@ void QgsIdentifyResults::featureForm()
877882 if ( !vlayer->featureAtId ( fid, f ) )
878883 return ;
879884
880- QgsFeatureAction action ( tr ( " Attribute changes" ), f, vlayer, idx, this );
885+ QgsFeatureAction action ( tr ( " Attribute changes" ), f, vlayer, idx, - 1 , this );
881886 if ( vlayer->isEditable () )
882887 {
883888 if ( action.editFeature () )
0 commit comments