From e655a7347d0a53f15d1f1ee5ff6fbcbb3001124e Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 6 Jul 2015 16:35:15 +0300 Subject: [PATCH] Issue #660 Move Group is still not implemented canMoveFeature is realized to enable/disable popup menu. --- src/XGUI/XGUI_ContextMenuMgr.cpp | 12 +++++++----- src/XGUI/XGUI_Workshop.cpp | 6 ++++++ src/XGUI/XGUI_Workshop.h | 4 ++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index bd1f2012f..8da4ebda2 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -188,7 +188,9 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu() if (!(hasParameter || hasFeature)) action("SHOW_ONLY_CMD")->setEnabled(true); } - } + else if (hasFeature && myWorkshop->canMoveFeature()) + action("MOVE_CMD")->setEnabled(true); + } } else { if (hasResult && (!hasParameter)) { action("SHOW_CMD")->setEnabled(true); @@ -200,9 +202,6 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu() } if (hasFeature || hasParameter) action("DELETE_CMD")->setEnabled(true); - - if (hasFeature || hasParameter) - action("MOVE_CMD")->setEnabled(true); } if (myWorkshop->canChangeColor()) action("COLOR_CMD")->setEnabled(true); @@ -294,6 +293,9 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu() aList.append(action("DELETE_CMD")); aList.append(action("MOVE_CMD")); myObjBrowserMenus[ModelAPI_Feature::group()] = aList; + + aList.clear(); + aList.append(action("DELETE_CMD")); myObjBrowserMenus[ModelAPI_ResultParameter::group()] = aList; //------------------------------------- } @@ -348,7 +350,7 @@ QMenu* XGUI_ContextMenuMgr::objBrowserMenu() const aActions.append(action("SHOW_ONLY_CMD")); aActions.append(mySeparator); aActions.append(action("DELETE_CMD")); - aActions.append(action("MOVE_CMD")); + //aActions.append(action("MOVE_CMD")); } aMenu->addActions(aActions); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 2614975ff..13f546677 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1229,6 +1229,12 @@ bool hasResults(QObjectPtrList theObjects, const std::set& theTypes return isFoundResultType; } +//************************************************************** +bool XGUI_Workshop::canMoveFeature() +{ + return true; +} + //************************************************************** bool XGUI_Workshop::canChangeColor() const { diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 79abe20b9..8b44268d0 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -163,6 +163,10 @@ Q_OBJECT //! Delete features void deleteObjects(); + //! Returns true if the selected feature can be moved to the position after the current feature + //! \return boolean value + bool canMoveFeature(); + //! Move selected features to be after the current feature void moveObjects(); -- 2.39.2