From eb8b99120aca1e9258b4568d9939bb38fa0940bc Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 28 Sep 2015 16:49:40 +0300 Subject: [PATCH] Issue #1022: Do not call pop-up on non selected index --- src/XGUI/XGUI_ObjectsBrowser.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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); } -- 2.39.2