From: vsv Date: Mon, 28 Sep 2015 13:49:40 +0000 (+0300) Subject: Issue #1022: Do not call pop-up on non selected index X-Git-Tag: V_1.4.0_demo1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eb8b99120aca1e9258b4568d9939bb38fa0940bc;p=modules%2Fshaper.git Issue #1022: Do not call pop-up on non selected index --- diff --git a/src/XGUI/XGUI_ObjectsBrowser.cpp b/src/XGUI/XGUI_ObjectsBrowser.cpp index d89d6171b..9eee72dce 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.cpp +++ b/src/XGUI/XGUI_ObjectsBrowser.cpp @@ -288,7 +288,12 @@ void XGUI_ObjectsBrowser::onContextMenuRequested(QContextMenuEvent* theEvent) QModelIndexList aIndexes; QObjectPtrList aSelectedData = selectedObjects(&aIndexes); bool toEnable = false; + if (aSelectedData.size() == 1) { + QModelIndex aSelected = myTreeView->indexAt(theEvent->pos()); + if (!aIndexes.contains(aSelected)) + return; // menu is called on non selected item + Qt::ItemFlags aFlags = dataModel()->flags(aIndexes.first()); toEnable = ((aFlags & Qt::ItemIsEditable) != 0); }