Skip to content

Commit 2e41442

Browse files
author
jef
committed
fix #2682
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13469 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 72d2f43 commit 2e41442

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/app/qgsidentifyresults.cpp

+10-7
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,10 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
378378
QTreeWidgetItem *featItem = featureItem( item );
379379
if ( featItem )
380380
{
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() ) );
382385
mActionPopup->addAction( tr( "Zoom to feature" ), this, SLOT( zoomToFeature() ) );
383386
mActionPopup->addAction( tr( "Copy attribute value" ), this, SLOT( copyAttributeValue() ) );
384387
mActionPopup->addAction( tr( "Copy feature attributes" ), this, SLOT( copyFeatureAttributes() ) );
@@ -393,26 +396,23 @@ void QgsIdentifyResults::contextMenuEvent( QContextMenuEvent* event )
393396
mActionPopup->addAction( tr( "Expand all" ), this, SLOT( expandAll() ) );
394397
mActionPopup->addAction( tr( "Collapse all" ), this, SLOT( collapseAll() ) );
395398

396-
if ( vlayer->actions()->size() > 0 )
399+
if ( featItem && vlayer->actions()->size() > 0 )
397400
{
398401
mActionPopup->addSeparator();
399402

400403
// The assumption is made that an instance of QgsIdentifyResults is
401404
// created for each new Identify Results dialog box, and that the
402405
// contents of the popup menu doesn't change during the time that
403406
// such a dialog box is around.
404-
QAction *a = mActionPopup->addAction( tr( "Run action" ) );
405-
a->setEnabled( false );
406-
407407
for ( int i = 0; i < vlayer->actions()->size(); i++ )
408408
{
409409
const QgsAction &action = vlayer->actions()->at( i );
410410

411411
if ( !action.runable() )
412412
continue;
413413

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() ) );
416416
}
417417
}
418418

@@ -525,6 +525,9 @@ void QgsIdentifyResults::doAction( QTreeWidgetItem *item, int action )
525525

526526
QTreeWidgetItem *QgsIdentifyResults::featureItem( QTreeWidgetItem *item )
527527
{
528+
if ( !item )
529+
return 0;
530+
528531
QTreeWidgetItem *featItem;
529532
if ( item->parent() )
530533
{

0 commit comments

Comments
 (0)