From c07fd4a1db8da220d16424c4a0e8a43a0f056e3f Mon Sep 17 00:00:00 2001 From: jef Date: Mon, 20 Sep 2010 18:59:10 +0000 Subject: [PATCH] fix #3021 git-svn-id: http://svn.osgeo.org/qgis/trunk@14266 c8812cc2-4d05-0410-92ff-de0c093fc19c --- src/app/legend/qgslegend.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/legend/qgslegend.cpp b/src/app/legend/qgslegend.cpp index 9dd4e72d246f..9e99c79e7dd4 100644 --- a/src/app/legend/qgslegend.cpp +++ b/src/app/legend/qgslegend.cpp @@ -218,8 +218,12 @@ void QgsLegend::mousePressEvent( QMouseEvent * e ) else if ( e->button() == Qt::RightButton ) { QTreeWidgetItem* item = itemAt( e->pos() ); - if ( item == currentItem() ) + if ( !item || item == currentItem() ) + { + if ( !item ) + setCurrentItem( 0 ); handleRightClickEvent( item, e->globalPos() ); + } } QTreeWidget::mousePressEvent( e ); } // contentsMousePressEvent