From 6c8feeb60a9fd7ac6e1ede1a390512102f6502c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Thu, 29 Aug 2019 11:46:41 +0200 Subject: [PATCH 1/2] caf: Made Right upper cross-button (cancle) work in the tabbed property dialog --- .../cafUserInterface/cafPdmUiTabbedPropertyViewDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTabbedPropertyViewDialog.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTabbedPropertyViewDialog.cpp index 6076f4f364..7b9f89c794 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTabbedPropertyViewDialog.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTabbedPropertyViewDialog.cpp @@ -21,7 +21,7 @@ PdmUiTabbedPropertyViewDialog::PdmUiTabbedPropertyViewDialog(caf::PdmObject* obj const QStringList& uiConfigNameForTabs, const QString& windowTitle, QWidget* parent) - : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint) + : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint) { this->setWindowTitle(windowTitle); From 01921a50ab1322f40b91e4018d20f34aa45b787d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Thu, 29 Aug 2019 11:48:43 +0200 Subject: [PATCH 2/2] caf: Create a new CommandFeature libary. Move Add and Delete command features there. Implement generic Toggle Commands. Make library an cmake "OBJECT" library to allow "registering by static initialization". Add the concept of CurrentContextMenuTargetWidget into CmdFeatureManager to support the toggle commands. Updated test application to use the new commands --- Fwk/AppFwk/CMakeLists.txt | 1 + Fwk/AppFwk/cafCommand/CMakeLists.txt | 14 -- .../cafCommand/cafCmdFeatureManager.cpp | 24 ++- Fwk/AppFwk/cafCommand/cafCmdFeatureManager.h | 15 +- .../cafCommand/cafCmdUiCommandSystemImpl.cpp | 8 + .../cafCommand/cafCmdUiCommandSystemImpl.h | 1 + .../AddAndDelete}/cafCmdAddItemExec.cpp | 0 .../AddAndDelete}/cafCmdAddItemExec.h | 0 .../AddAndDelete}/cafCmdAddItemExecData.cpp | 0 .../AddAndDelete}/cafCmdAddItemExecData.h | 0 .../AddAndDelete}/cafCmdAddItemFeature.cpp | 0 .../AddAndDelete}/cafCmdAddItemFeature.h | 0 .../AddAndDelete}/cafCmdDeleteItemExec.cpp | 0 .../AddAndDelete}/cafCmdDeleteItemExec.h | 0 .../cafCmdDeleteItemExecData.cpp | 0 .../AddAndDelete}/cafCmdDeleteItemExecData.h | 0 .../AddAndDelete}/cafCmdDeleteItemFeature.cpp | 0 .../AddAndDelete}/cafCmdDeleteItemFeature.h | 0 Fwk/AppFwk/cafCommandFeatures/CMakeLists.txt | 95 ++++++++ .../Resources/ToggleOffL16x16.png | Bin 0 -> 312 bytes .../Resources/ToggleOnL16x16.png | Bin 0 -> 369 bytes .../Resources/ToggleOnOffL16x16.png | Bin 0 -> 556 bytes .../Resources/ToggleOnOthersOffL16x16.png | Bin 0 -> 482 bytes .../Resources/cafCommandFeatures.qrc | 8 + .../ToggleCommands/cafToggleItemsFeature.cpp | 79 +++++++ .../ToggleCommands/cafToggleItemsFeature.h | 57 +++++ .../cafToggleItemsFeatureImpl.cpp | 204 ++++++++++++++++++ .../cafToggleItemsFeatureImpl.h | 70 ++++++ .../cafToggleItemsOffFeature.cpp | 80 +++++++ .../ToggleCommands/cafToggleItemsOffFeature.h | 57 +++++ .../cafToggleItemsOnFeature.cpp | 80 +++++++ .../ToggleCommands/cafToggleItemsOnFeature.h | 58 +++++ .../cafToggleItemsOnOthersOffFeature.cpp | 165 ++++++++++++++ .../cafToggleItemsOnOthersOffFeature.h | 68 ++++++ .../cafInternalPdmUiCommandSystemInterface.h | 3 + .../cafPdmUiCommandSystemProxy.cpp | 11 + .../cafPdmUiCore/cafPdmUiCommandSystemProxy.h | 2 + .../cafPdmUiFieldEditorHandle.cpp | 3 + .../cafTestApplication/CMakeLists.txt | 2 + .../cafTestApplication/MainWindow.cpp | 37 ++++ .../cafTests/cafTestApplication/MainWindow.h | 2 + .../cafPdmUiTreeViewEditor.cpp | 4 + 42 files changed, 1123 insertions(+), 25 deletions(-) rename Fwk/AppFwk/{cafCommand/defaultfeatures => cafCommandFeatures/AddAndDelete}/cafCmdAddItemExec.cpp (100%) rename Fwk/AppFwk/{cafCommand/defaultfeatures => cafCommandFeatures/AddAndDelete}/cafCmdAddItemExec.h (100%) rename Fwk/AppFwk/{cafCommand/defaultfeatures => cafCommandFeatures/AddAndDelete}/cafCmdAddItemExecData.cpp (100%) rename Fwk/AppFwk/{cafCommand/defaultfeatures => cafCommandFeatures/AddAndDelete}/cafCmdAddItemExecData.h (100%) rename Fwk/AppFwk/{cafCommand/defaultfeatures => cafCommandFeatures/AddAndDelete}/cafCmdAddItemFeature.cpp (100%) rename Fwk/AppFwk/{cafCommand/defaultfeatures => cafCommandFeatures/AddAndDelete}/cafCmdAddItemFeature.h (100%) rename Fwk/AppFwk/{cafCommand/defaultfeatures => cafCommandFeatures/AddAndDelete}/cafCmdDeleteItemExec.cpp (100%) rename Fwk/AppFwk/{cafCommand/defaultfeatures => cafCommandFeatures/AddAndDelete}/cafCmdDeleteItemExec.h (100%) rename Fwk/AppFwk/{cafCommand/defaultfeatures => cafCommandFeatures/AddAndDelete}/cafCmdDeleteItemExecData.cpp (100%) rename Fwk/AppFwk/{cafCommand/defaultfeatures => cafCommandFeatures/AddAndDelete}/cafCmdDeleteItemExecData.h (100%) rename Fwk/AppFwk/{cafCommand/defaultfeatures => cafCommandFeatures/AddAndDelete}/cafCmdDeleteItemFeature.cpp (100%) rename Fwk/AppFwk/{cafCommand/defaultfeatures => cafCommandFeatures/AddAndDelete}/cafCmdDeleteItemFeature.h (100%) create mode 100644 Fwk/AppFwk/cafCommandFeatures/CMakeLists.txt create mode 100644 Fwk/AppFwk/cafCommandFeatures/Resources/ToggleOffL16x16.png create mode 100644 Fwk/AppFwk/cafCommandFeatures/Resources/ToggleOnL16x16.png create mode 100644 Fwk/AppFwk/cafCommandFeatures/Resources/ToggleOnOffL16x16.png create mode 100644 Fwk/AppFwk/cafCommandFeatures/Resources/ToggleOnOthersOffL16x16.png create mode 100644 Fwk/AppFwk/cafCommandFeatures/Resources/cafCommandFeatures.qrc create mode 100644 Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeature.cpp create mode 100644 Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeature.h create mode 100644 Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeatureImpl.cpp create mode 100644 Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeatureImpl.h create mode 100644 Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOffFeature.cpp create mode 100644 Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOffFeature.h create mode 100644 Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnFeature.cpp create mode 100644 Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnFeature.h create mode 100644 Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnOthersOffFeature.cpp create mode 100644 Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnOthersOffFeature.h diff --git a/Fwk/AppFwk/CMakeLists.txt b/Fwk/AppFwk/CMakeLists.txt index a844191dd5..6e9d39d440 100644 --- a/Fwk/AppFwk/CMakeLists.txt +++ b/Fwk/AppFwk/CMakeLists.txt @@ -45,6 +45,7 @@ add_subdirectory (cafProjectDataModel/cafPdmXml) add_subdirectory(cafProjectDataModel) add_subdirectory(cafCommand) +add_subdirectory(cafCommandFeatures) add_subdirectory(cafUserInterface) #executables diff --git a/Fwk/AppFwk/cafCommand/CMakeLists.txt b/Fwk/AppFwk/cafCommand/CMakeLists.txt index 713a1954b5..f10513ec59 100644 --- a/Fwk/AppFwk/cafCommand/CMakeLists.txt +++ b/Fwk/AppFwk/cafCommand/CMakeLists.txt @@ -28,20 +28,6 @@ set( PROJECT_FILES cafCmdUiCommandSystemImpl.h cafCmdUiCommandSystemImpl.cpp - # Default features - defaultfeatures/cafCmdAddItemExec.cpp - defaultfeatures/cafCmdAddItemExec.h - defaultfeatures/cafCmdAddItemExecData.cpp - defaultfeatures/cafCmdAddItemExecData.h - defaultfeatures/cafCmdAddItemFeature.cpp - defaultfeatures/cafCmdAddItemFeature.h - defaultfeatures/cafCmdDeleteItemExec.cpp - defaultfeatures/cafCmdDeleteItemExec.h - defaultfeatures/cafCmdDeleteItemExecData.cpp - defaultfeatures/cafCmdDeleteItemExecData.h - defaultfeatures/cafCmdDeleteItemFeature.cpp - defaultfeatures/cafCmdDeleteItemFeature.h - cafCmdFieldChangeExec.cpp cafCmdFieldChangeExec.h diff --git a/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.cpp b/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.cpp index 445ac8553f..e906eeb10a 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.cpp +++ b/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.cpp @@ -41,9 +41,6 @@ #include "cafCmdSelectionHelper.h" #include "cafFactory.h" -#include "defaultfeatures/cafCmdDeleteItemFeature.h" -#include "defaultfeatures/cafCmdAddItemFeature.h" - #include #include @@ -56,9 +53,6 @@ namespace caf //-------------------------------------------------------------------------------------------------- CmdFeatureManager::CmdFeatureManager() { - CmdDeleteItemFeature::idNameStatic(); - CmdAddItemFeature::idNameStatic(); - // Make sure all command features are created. The command feature is registered // in the command factory, and instantiated when required. This will enable possibility // of searching through all command features instead of having to use the string keys to @@ -66,7 +60,7 @@ CmdFeatureManager::CmdFeatureManager() std::vector keys = CommandFeatureFactory::instance()->allKeys(); for (size_t i = 0; i < keys.size(); i++) { - action(QString::fromStdString(keys[i])); + createFeature(keys[i]); } } @@ -337,4 +331,20 @@ std::vector CmdFeatureManager::commandFeaturesMatchingKeyboardShort return matches; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void CmdFeatureManager::setCurrentContextMenuTargetWidget(QWidget * targetWidget) +{ + m_currentContextMenuTargetWidget = targetWidget; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QWidget* CmdFeatureManager::currentContextMenuTargetWidget() +{ + return m_currentContextMenuTargetWidget; +} + } // end namespace caf diff --git a/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.h b/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.h index 76fe9cc931..89ef3a30a8 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.h +++ b/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.h @@ -43,9 +43,11 @@ #include #include +#include class QAction; class QKeySequence; +class QWidget; namespace caf { @@ -66,14 +68,18 @@ public: QAction* action(const QString& commandId); QAction* action(const QString& commandId, const QString& customActionText); QAction* actionWithUserData(const QString& commandId, const QString& customActionText, const QVariant& userData); - void refreshStates(const QStringList& commandIdList = QStringList()); - void refreshEnabledState(const QStringList& commandIdList = QStringList()); - void refreshCheckedState(const QStringList& commandIdList = QStringList()); - CmdFeature* getCommandFeature(const std::string& commandId); + void refreshStates(const QStringList& commandIdList = QStringList()); + void refreshEnabledState(const QStringList& commandIdList = QStringList()); + void refreshCheckedState(const QStringList& commandIdList = QStringList()); + CmdFeature* getCommandFeature(const std::string& commandId); std::vector commandFeaturesMatchingSubString(const std::string& subString) const; std::vector commandFeaturesMatchingKeyboardShortcut(const QKeySequence& keySequence) const; + + void setCurrentContextMenuTargetWidget(QWidget * targetWidget); + QWidget* currentContextMenuTargetWidget(); + private: CmdFeatureManager(); @@ -87,6 +93,7 @@ private: std::map m_commandIdToFeatureIdxMap; std::map m_actionToFeatureIdxMap; + QPointer m_currentContextMenuTargetWidget; }; diff --git a/Fwk/AppFwk/cafCommand/cafCmdUiCommandSystemImpl.cpp b/Fwk/AppFwk/cafCommand/cafCmdUiCommandSystemImpl.cpp index 574c5a8954..a4e6405954 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdUiCommandSystemImpl.cpp +++ b/Fwk/AppFwk/cafCommand/cafCmdUiCommandSystemImpl.cpp @@ -168,4 +168,12 @@ bool CmdUiCommandSystemImpl::disableUndoForFieldChange() return m_disableUndoForFieldChange; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void CmdUiCommandSystemImpl::setCurrentContextMenuTargetWidget(QWidget* targetWidget) +{ + caf::CmdFeatureManager::instance()->setCurrentContextMenuTargetWidget(targetWidget); +} + } // end namespace caf diff --git a/Fwk/AppFwk/cafCommand/cafCmdUiCommandSystemImpl.h b/Fwk/AppFwk/cafCommand/cafCmdUiCommandSystemImpl.h index 5fe57e6625..ed296235f4 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdUiCommandSystemImpl.h +++ b/Fwk/AppFwk/cafCommand/cafCmdUiCommandSystemImpl.h @@ -51,6 +51,7 @@ public: CmdUiCommandSystemImpl(); void fieldChangedCommand(const std::vector& fieldsToUpdate, const QVariant& newUiValue) override; + void setCurrentContextMenuTargetWidget(QWidget* targetWidget) override; void populateMenuWithDefaultCommands(const QString& uiConfigName, QMenu* menu) override; bool isUndoEnabled(); diff --git a/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdAddItemExec.cpp b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemExec.cpp similarity index 100% rename from Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdAddItemExec.cpp rename to Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemExec.cpp diff --git a/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdAddItemExec.h b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemExec.h similarity index 100% rename from Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdAddItemExec.h rename to Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemExec.h diff --git a/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdAddItemExecData.cpp b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemExecData.cpp similarity index 100% rename from Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdAddItemExecData.cpp rename to Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemExecData.cpp diff --git a/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdAddItemExecData.h b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemExecData.h similarity index 100% rename from Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdAddItemExecData.h rename to Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemExecData.h diff --git a/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdAddItemFeature.cpp b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemFeature.cpp similarity index 100% rename from Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdAddItemFeature.cpp rename to Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemFeature.cpp diff --git a/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdAddItemFeature.h b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemFeature.h similarity index 100% rename from Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdAddItemFeature.h rename to Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemFeature.h diff --git a/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemExec.cpp b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemExec.cpp similarity index 100% rename from Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemExec.cpp rename to Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemExec.cpp diff --git a/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemExec.h b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemExec.h similarity index 100% rename from Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemExec.h rename to Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemExec.h diff --git a/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemExecData.cpp b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemExecData.cpp similarity index 100% rename from Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemExecData.cpp rename to Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemExecData.cpp diff --git a/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemExecData.h b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemExecData.h similarity index 100% rename from Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemExecData.h rename to Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemExecData.h diff --git a/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemFeature.cpp b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemFeature.cpp similarity index 100% rename from Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemFeature.cpp rename to Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemFeature.cpp diff --git a/Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemFeature.h b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemFeature.h similarity index 100% rename from Fwk/AppFwk/cafCommand/defaultfeatures/cafCmdDeleteItemFeature.h rename to Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemFeature.h diff --git a/Fwk/AppFwk/cafCommandFeatures/CMakeLists.txt b/Fwk/AppFwk/cafCommandFeatures/CMakeLists.txt new file mode 100644 index 0000000000..21d3791811 --- /dev/null +++ b/Fwk/AppFwk/cafCommandFeatures/CMakeLists.txt @@ -0,0 +1,95 @@ +cmake_minimum_required (VERSION 2.8.12) + +project (cafCommandFeatures) + + +# These headers need to go through Qt's MOC compiler +set (MOC_HEADER_FILES + +) + +# Qt +if (CEE_USE_QT5) + find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets) + set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) + qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES} ) +else() + find_package(Qt4 COMPONENTS QtCore QtGui QtMain REQUIRED) + include(${QT_USE_FILE}) + qt4_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES} ) +endif(CEE_USE_QT5) + +set( PROJECT_FILES + + # Default features + AddAndDelete/cafCmdAddItemExec.cpp + AddAndDelete/cafCmdAddItemExec.h + AddAndDelete/cafCmdAddItemExecData.cpp + AddAndDelete/cafCmdAddItemExecData.h + AddAndDelete/cafCmdAddItemFeature.cpp + AddAndDelete/cafCmdAddItemFeature.h + AddAndDelete/cafCmdDeleteItemExec.cpp + AddAndDelete/cafCmdDeleteItemExec.h + AddAndDelete/cafCmdDeleteItemExecData.cpp + AddAndDelete/cafCmdDeleteItemExecData.h + AddAndDelete/cafCmdDeleteItemFeature.cpp + AddAndDelete/cafCmdDeleteItemFeature.h + + ToggleCommands/cafToggleItemsFeature.cpp + ToggleCommands/cafToggleItemsFeature.h + ToggleCommands/cafToggleItemsFeatureImpl.cpp + ToggleCommands/cafToggleItemsFeatureImpl.h + ToggleCommands/cafToggleItemsOffFeature.cpp + ToggleCommands/cafToggleItemsOffFeature.h + ToggleCommands/cafToggleItemsOnFeature.cpp + ToggleCommands/cafToggleItemsOnFeature.h + ToggleCommands/cafToggleItemsOnOthersOffFeature.cpp + ToggleCommands/cafToggleItemsOnOthersOffFeature.h +) + +# NOTE! Resources in this subfolder appends to the variable QRC_FILES in parent scope +# CMakeList.txt in the application folder (parent scope) must use the following syntax +# to make sure the QRC_FILES variable contains appended files in subfolders + +# set( QRC_FILES +# ${QRC_FILES} +# +# ) + +set( QRC_FILES + ${QRC_FILES} + ${CMAKE_CURRENT_SOURCE_DIR}/Resources/cafCommandFeatures.qrc + PARENT_SCOPE +) + +# NOTE! Adding the library as a cmake "OBJECT" library +# to make sure the linker is not pruning the seemingly unused features, +# and to make sure that the static initialization based registration of the features into the factory is done properly +# see https://gitlab.kitware.com/cmake/community/wikis/doc/tutorials/Object-Library +# and https://cmake.org/cmake/help/v3.15/command/add_library.html?highlight=add_library#object-libraries +add_library( ${PROJECT_NAME} OBJECT + ${PROJECT_FILES} + ${MOC_SOURCE_FILES} +) + +target_include_directories(${PROJECT_NAME} + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_link_libraries ( ${PROJECT_NAME} + cafCommand + cafUserInterface + ${QT_LIBRARIES} +) + +if (MSVC) + set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/W4 /wd4100 /wd4127") +endif() + +source_group("" FILES ${PROJECT_FILES}) + +# cotire +if (COMMAND caf_apply_cotire) + caf_apply_cotire("${PROJECT_NAME}") +endif() diff --git a/Fwk/AppFwk/cafCommandFeatures/Resources/ToggleOffL16x16.png b/Fwk/AppFwk/cafCommandFeatures/Resources/ToggleOffL16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..237744a234a331849ece2ac78ab6cbe14e0fe08d GIT binary patch literal 312 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP-2OFoN!JCegfj}Y264!_l=ltB<)VvY~=c3falGGH1 z^30M91$R&1fbd2>aiF3Fo-U3d7N_3^dh#7I5GbCkH!GJ_K2+I- zEnHQyGG*Vtrm4&NBRxJL@*vI*(TEaPF zmRQuwv!Y%00{5Md{5KVs_OVRf(?8o-F5)qF*8}n1&vp~~fNo{*boFyt=akR{0NqA! AzyJUM literal 0 HcmV?d00001 diff --git a/Fwk/AppFwk/cafCommandFeatures/Resources/ToggleOnL16x16.png b/Fwk/AppFwk/cafCommandFeatures/Resources/ToggleOnL16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..0591c6f8a25ce4eeb305881bfe882b351ce168db GIT binary patch literal 369 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP-2OFo7nCJ@me4vnIiEBiObAE1aYF-J0b5UwyNotBh zd1gt5g1e`0KzJjcI8f0|PZ!4!i_^&o60AKhn0R@4|F^ojY|yIv{fyVy*_pXZPOQZB zkdhLQeVwtPhlhs&2Pe02L1B@>9IL|qhi6}}=P4?h!DgJenKSb9+1L6Ka`);_A2@if z>uP8OZ^f@C?1#^0ua~I%n~<`j;GN*%|NnV-Qd1p|NGBvNJ@w(!PxrRm=yQgDet(~T z@b>MN#^$-r70eYoEhLPLV$`iHVMEo}P+qva+mu zE}m%8U1gSk^UMJdIC%0v!Si?AZPw-f2cEhysxdIgF0=k(mljqJ^dy6)tDnm{r-UW| D&(ntC literal 0 HcmV?d00001 diff --git a/Fwk/AppFwk/cafCommandFeatures/Resources/ToggleOnOffL16x16.png b/Fwk/AppFwk/cafCommandFeatures/Resources/ToggleOnOffL16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..f57d91b14bd3d7abc5469099b94d2fbe0821f53d GIT binary patch literal 556 zcmV+{0@MA8P)e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{00ERqL_t(I%Z-vfPuox!g&$w% z!@h}uV5^lnR-#+gwJU50S+M0dU?%o9joQv-Dg)}6#aqkWn;!sTKp=*8Y6k?1AytV` z9N!K#aN`=9GoSm|?>WcncDvdS0<_iu*g`PQGLj_WO{Zh=A65Jy;OVpHNY}x(1qXXS zxV#wBY>t>l6|FUmhU8H&&(YyezJEJoVc`jBdJaGswl{$fxqn-!c*6t;fI%{3kPPX6 zJz_l0h}Ktb4NApZO2roN1&G41{c!?d3&F|pDZ9J-WSM4d^=0X=DiyB*+c`vsVS5ok zjM9`STITvX#q(U2mR^(s@-IgQun%CpefM5Br2OZ>@2e|1uU}aOh`uk2sT79oO#@PD z(0S@pt5Ud;ys|CR^w8KUhA%Q<=8eU%&CPl|4(93gdVc{omE0GQIku*BsMo4U>D~=V zskony<)-J)#alh;5VSnzW}8Uq;?$ixfYI$n4p}t=wS~ZM&EUEYwOal5@kEFP$ixYw uG{yH@RI4>?VVAe?kOqTa?Cg9h9oru`9-)x&H|?GP0000e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{00Bx#L_t(I%bk)vPr^_bMo(`G zw8e_01rkOFH{$8mp9n(mD_f&`{7b zzxO%!KKGRz$B8W4CW;~eWFZ)YA+GCk&}c}^L9uL`)wOkWO+}Uk7w1oWynkbweHKAP zQA9SYQ!3iLK6kmld!tauu_yw-b9;DhkJFPY27{2w{?5VyiYx>-*DsuXJ`#ozd%K(b z1*IPZR4Usz&M}6ev9+}k8%io#@w_kE?IX(N;c&Cn0-)>rzX8)lujC9$cAieBL*h3j znQPT5?e-x`Qb3Yf&8Wi;=9wREFJtD368~#X3>Ym}(ay7^t7OtCbX}X6X|`H)eSdZb zhOT0p2CAAtl0?j0uh*oRH;{$EGMCXbl~gK?EaaFu@d^DPz_QHP;c;_fz-YOq88?sk Y0i`vN{PxG + + ToggleOnL16x16.png + ToggleOffL16x16.png + ToggleOnOffL16x16.png + ToggleOnOthersOffL16x16.png + + \ No newline at end of file diff --git a/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeature.cpp b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeature.cpp new file mode 100644 index 0000000000..b6cc3b7acc --- /dev/null +++ b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeature.cpp @@ -0,0 +1,79 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2019- Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#include "cafToggleItemsFeature.h" + +#include "cafToggleItemsFeatureImpl.h" + +#include "cafSelectionManager.h" + +#include + +namespace caf +{ + +CAF_CMD_SOURCE_INIT(ToggleItemsFeature, "cafToggleItemsFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool ToggleItemsFeature::isCommandEnabled() +{ + return ToggleItemsFeatureImpl::isToggleCommandsAvailable(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void ToggleItemsFeature::onActionTriggered(bool isChecked) +{ + ToggleItemsFeatureImpl::setObjectToggleStateForSelection(ToggleItemsFeatureImpl::TOGGLE_SUBITEMS); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void ToggleItemsFeature::setupActionLook(QAction* actionToSetup) +{ + if (ToggleItemsFeatureImpl::isToggleCommandsForSubItems()) + actionToSetup->setText("Toggle Sub Items"); + else + actionToSetup->setText("Toggle"); + + actionToSetup->setIcon(QIcon(":/cafCommandFeatures/ToggleOnOffL16x16.png")); +} + +} \ No newline at end of file diff --git a/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeature.h b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeature.h new file mode 100644 index 0000000000..d315b9d4ad --- /dev/null +++ b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeature.h @@ -0,0 +1,57 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2019- Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#pragma once + +#include "cafCmdFeature.h" + +namespace caf +{ +//================================================================================================== +/// +//================================================================================================== +class ToggleItemsFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; +protected: + + // Overrides + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; + +} \ No newline at end of file diff --git a/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeatureImpl.cpp b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeatureImpl.cpp new file mode 100644 index 0000000000..f9be5c3a3f --- /dev/null +++ b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeatureImpl.cpp @@ -0,0 +1,204 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2019- Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#include "cafToggleItemsFeatureImpl.h" + +//#include "RiaFeatureCommandContext.h" +//#include "RiaGuiApplication.h" +//#include "RiuMainWindow.h" +//#include "RiuPlotMainWindow.h" + +#include "cafPdmUiFieldHandle.h" +#include "cafPdmUiItem.h" +#include "cafPdmUiObjectHandle.h" +#include "cafPdmUiTreeOrdering.h" +#include "cafPdmUiTreeView.h" +#include "cafSelectionManager.h" + +#include + +#include +#include "cafCmdFeatureManager.h" + +namespace caf +{ + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool ToggleItemsFeatureImpl::isToggleCommandsAvailable() +{ + std::vector selectedItems; + caf::SelectionManager::instance()->selectedItems(selectedItems); + + if (selectedItems.size() == 1) + { + caf::PdmUiTreeOrdering* treeItem = findTreeItemFromSelectedUiItem(selectedItems[0]); + + if (!treeItem) return false; + + for (int cIdx = 0; cIdx < treeItem->childCount(); ++ cIdx) + { + caf::PdmUiTreeOrdering* child = treeItem->child(cIdx); + if (!child) continue; + if (!child->isRepresentingObject()) continue; + + caf::PdmObjectHandle* childObj = child->object(); + caf::PdmUiObjectHandle* uiObjectHandleChild = uiObj(childObj); + + if (uiObjectHandleChild && + uiObjectHandleChild->objectToggleField() && + !uiObjectHandleChild->objectToggleField()->uiCapability()->isUiReadOnly()) + { + return true; + } + } + } + else + { + for (size_t i = 0; i < selectedItems.size(); ++i) + { + caf::PdmUiObjectHandle* uiObjectHandle = dynamic_cast(selectedItems[i]); + + if (uiObjectHandle && uiObjectHandle->objectToggleField()) + { + return true; + } + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool ToggleItemsFeatureImpl::isToggleCommandsForSubItems() +{ + std::vector selectedItems; + caf::SelectionManager::instance()->selectedItems(selectedItems); + if (isToggleCommandsAvailable() && selectedItems.size() == 1) + { + return true; + } + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// Set toggle state for list of model indices. +//-------------------------------------------------------------------------------------------------- +void ToggleItemsFeatureImpl::setObjectToggleStateForSelection(SelectionToggleType state) +{ + std::vector selectedItems; + caf::SelectionManager::instance()->selectedItems(selectedItems); + if (state != TOGGLE && selectedItems.size() == 1) + { + // If only one item is selected, loop over its children, and toggle them instead of the + // selected item directly + + // We need to get the children through the tree view, because that is where the actually shown children is + + caf::PdmUiTreeOrdering* treeItem = findTreeItemFromSelectedUiItem(selectedItems[0]); + + if (!treeItem) return; + + for (int cIdx = 0; cIdx < treeItem->childCount(); ++ cIdx) + { + caf::PdmUiTreeOrdering* child = treeItem->child(cIdx); + if (!child) continue; + if (!child->isRepresentingObject()) continue; + + caf::PdmObjectHandle* childObj = child->object(); + caf::PdmUiObjectHandle* uiObjectHandleChild = uiObj(childObj); + + if (uiObjectHandleChild && uiObjectHandleChild->objectToggleField()) + { + caf::PdmField* field = dynamic_cast*>(uiObjectHandleChild->objectToggleField()); + + if (state == TOGGLE_ON) field->setValueWithFieldChanged(true); + if (state == TOGGLE_OFF) field->setValueWithFieldChanged(false); + if (state == TOGGLE_SUBITEMS) field->setValueWithFieldChanged(!(field->v())); + } + } + } + else + { + for (size_t i = 0; i < selectedItems.size(); ++i) + { + caf::PdmUiObjectHandle* uiObjectHandle = dynamic_cast< caf::PdmUiObjectHandle*>(selectedItems[i]); + + if (uiObjectHandle && uiObjectHandle->objectToggleField()) + { + caf::PdmField* field = dynamic_cast* >(uiObjectHandle->objectToggleField()); + + if (state == TOGGLE_ON) field->setValueWithFieldChanged(true); + if (state == TOGGLE_OFF) field->setValueWithFieldChanged(false); + if (state == TOGGLE_SUBITEMS || state == TOGGLE) + { + field->setValueWithFieldChanged(!(field->v())); + } + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmUiTreeView* ToggleItemsFeatureImpl::findTreeView(const caf::PdmUiItem* uiItem) +{ + caf::PdmUiTreeView* customActiveTreeView = dynamic_cast(CmdFeatureManager::instance()->currentContextMenuTargetWidget()); + + return customActiveTreeView; +} + +//-------------------------------------------------------------------------------------------------- +/// Finds the tree item in either the 3D main window or plot main window project tree view +//-------------------------------------------------------------------------------------------------- +caf::PdmUiTreeOrdering* ToggleItemsFeatureImpl::findTreeItemFromSelectedUiItem(const caf::PdmUiItem* uiItem) +{ + caf::PdmUiTreeView* pdmUiTreeView = findTreeView(uiItem); + + if (pdmUiTreeView) + { + QModelIndex modIndex = pdmUiTreeView->findModelIndex(uiItem); + return static_cast(modIndex.internalPointer()); + } + + return nullptr; +} + +} \ No newline at end of file diff --git a/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeatureImpl.h b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeatureImpl.h new file mode 100644 index 0000000000..ccb180a257 --- /dev/null +++ b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeatureImpl.h @@ -0,0 +1,70 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2019- Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#pragma once + +namespace caf +{ + class PdmUiItem; + class PdmUiTreeOrdering; + class PdmUiTreeView; + + +//================================================================================================== +/// +//================================================================================================== +class ToggleItemsFeatureImpl +{ +public: + enum SelectionToggleType + { + TOGGLE_ON, + TOGGLE_OFF, + TOGGLE_SUBITEMS, + TOGGLE, + TOGGLE_UNDEFINED + }; + + static bool isToggleCommandsAvailable(); + static bool isToggleCommandsForSubItems(); + static void setObjectToggleStateForSelection(SelectionToggleType state); + +private: + static caf::PdmUiTreeView* findTreeView(const caf::PdmUiItem* uiItem); + static caf::PdmUiTreeOrdering* findTreeItemFromSelectedUiItem(const caf::PdmUiItem* uiItem); +}; + +}; diff --git a/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOffFeature.cpp b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOffFeature.cpp new file mode 100644 index 0000000000..52b0f765ce --- /dev/null +++ b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOffFeature.cpp @@ -0,0 +1,80 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2019- Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#include "cafToggleItemsOffFeature.h" + +#include "cafToggleItemsFeatureImpl.h" + +#include "cafSelectionManager.h" + +#include + +namespace caf +{ + +CAF_CMD_SOURCE_INIT(ToggleItemsOffFeature, "cafToggleItemsOffFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool ToggleItemsOffFeature::isCommandEnabled() +{ + return ToggleItemsFeatureImpl::isToggleCommandsAvailable(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void ToggleItemsOffFeature::onActionTriggered(bool isChecked) +{ + ToggleItemsFeatureImpl::setObjectToggleStateForSelection(ToggleItemsFeatureImpl::TOGGLE_OFF); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void ToggleItemsOffFeature::setupActionLook(QAction* actionToSetup) +{ + if (ToggleItemsFeatureImpl::isToggleCommandsForSubItems()) + actionToSetup->setText("Sub Items Off"); + else + actionToSetup->setText("Off"); + + actionToSetup->setIcon(QIcon(":/cafCommandFeatures/ToggleOffL16x16.png")); + +} + +} \ No newline at end of file diff --git a/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOffFeature.h b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOffFeature.h new file mode 100644 index 0000000000..fac7525e2c --- /dev/null +++ b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOffFeature.h @@ -0,0 +1,57 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2019- Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#pragma once + +#include "cafCmdFeature.h" + +namespace caf +{ +//================================================================================================== +/// +//================================================================================================== +class ToggleItemsOffFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; +protected: + + // Overrides + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; + +} \ No newline at end of file diff --git a/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnFeature.cpp b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnFeature.cpp new file mode 100644 index 0000000000..de65c1985f --- /dev/null +++ b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnFeature.cpp @@ -0,0 +1,80 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2019- Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#include "cafToggleItemsOnFeature.h" + +#include "cafToggleItemsFeatureImpl.h" + +#include "cafSelectionManager.h" + +#include + +namespace caf +{ + +CAF_CMD_SOURCE_INIT(ToggleItemsOnFeature, "cafToggleItemsOnFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool ToggleItemsOnFeature::isCommandEnabled() +{ + return ToggleItemsFeatureImpl::isToggleCommandsAvailable(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void ToggleItemsOnFeature::onActionTriggered(bool isChecked) +{ + ToggleItemsFeatureImpl::setObjectToggleStateForSelection(ToggleItemsFeatureImpl::TOGGLE_ON); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void ToggleItemsOnFeature::setupActionLook(QAction* actionToSetup) +{ + if (ToggleItemsFeatureImpl::isToggleCommandsForSubItems()) + actionToSetup->setText("Sub Items On"); + else + actionToSetup->setText("On"); + + actionToSetup->setIcon(QIcon(":/cafCommandFeatures/ToggleOnL16x16.png")); + +} + +} \ No newline at end of file diff --git a/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnFeature.h b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnFeature.h new file mode 100644 index 0000000000..2b3b08ce07 --- /dev/null +++ b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnFeature.h @@ -0,0 +1,58 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2019- Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#pragma once + +#include "cafCmdFeature.h" + +namespace caf +{ + +//================================================================================================== +/// +//================================================================================================== +class ToggleItemsOnFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; +protected: + + // Overrides + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; + +} \ No newline at end of file diff --git a/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnOthersOffFeature.cpp b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnOthersOffFeature.cpp new file mode 100644 index 0000000000..0a9c06577a --- /dev/null +++ b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnOthersOffFeature.cpp @@ -0,0 +1,165 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2019- Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#include "cafToggleItemsOnOthersOffFeature.h" + +#include "cafToggleItemsFeatureImpl.h" + +#include "cafSelectionManager.h" + +#include +#include "cafPdmObjectHandle.h" +#include "cafPdmObject.h" +#include "cafPdmUiItem.h" + +namespace caf +{ + +CAF_CMD_SOURCE_INIT(ToggleItemsOnOthersOffFeature, "cafToggleItemsOnOthersOffFeature"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool ToggleItemsOnOthersOffFeature::isCommandEnabled() +{ + std::vector selectedObjects; + caf::SelectionManager::instance()->objectsByType(&selectedObjects); + + caf::PdmFieldHandle* commonParent = verifySameParentForSelection(selectedObjects); + std::vector children = childObjects(commonParent); + + return commonParent != nullptr + && children.size() > 0 + && objectToggleField(children.front()) + && children.size() > selectedObjects.size(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void ToggleItemsOnOthersOffFeature::onActionTriggered(bool isChecked) +{ + std::vector selectedObjects; + caf::SelectionManager::instance()->objectsByType(&selectedObjects); + + // First toggle off all siblings + + caf::PdmFieldHandle* commonParent = verifySameParentForSelection(selectedObjects); + + for (caf::PdmObjectHandle* child : childObjects(commonParent)) + { + caf::PdmField* field = objectToggleField(child); + + if (field) + { + field->setValueWithFieldChanged(false); + } + } + + // Then toggle on the selected item(s) + for (caf::PdmObject* selectedObject : selectedObjects) + { + caf::PdmField* field = dynamic_cast*>(selectedObject->objectToggleField()); + + field->setValueWithFieldChanged(true); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void ToggleItemsOnOthersOffFeature::setupActionLook(QAction* actionToSetup) +{ + actionToSetup->setText("On - Others Off"); + + actionToSetup->setIcon(QIcon(":/cafCommandFeatures/ToggleOnOthersOffL16x16.png")); + +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmFieldHandle* ToggleItemsOnOthersOffFeature::verifySameParentForSelection(const std::vector& selection) +{ + caf::PdmFieldHandle* sameParent = nullptr; + + for ( caf::PdmObject* obj : selection ) + { + caf::PdmFieldHandle* parent = obj->parentField(); + if ( parent ) + { + if ( !sameParent ) + { + sameParent = parent; + } + else if ( parent != sameParent ) + { + // Different parents detected + + return nullptr; + } + } + } + return sameParent; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector ToggleItemsOnOthersOffFeature::childObjects(caf::PdmFieldHandle* parent) +{ + std::vector children; + if ( parent ) + { + parent->childObjects(&children); + } + return children; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmField* ToggleItemsOnOthersOffFeature::objectToggleField(caf::PdmObjectHandle* objectHandle) +{ + caf::PdmUiObjectHandle* childUiObject = uiObj(objectHandle); + if ( childUiObject && childUiObject->objectToggleField() ) + { + return dynamic_cast*>(childUiObject->objectToggleField()); + } + return nullptr; +} + +} \ No newline at end of file diff --git a/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnOthersOffFeature.h b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnOthersOffFeature.h new file mode 100644 index 0000000000..ab5c4f8179 --- /dev/null +++ b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnOthersOffFeature.h @@ -0,0 +1,68 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2019- Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#pragma once + +#include "cafCmdFeature.h" +#include "cafPdmField.h" + +namespace caf +{ + class PdmFieldHandle; + class PdmObject; + class PdmObjectHandle; + + +//================================================================================================== +/// +//================================================================================================== +class ToggleItemsOnOthersOffFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; +protected: + + // Overrides + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + +private: + caf::PdmFieldHandle* verifySameParentForSelection(const std::vector& selectedObjects); + std::vector childObjects(caf::PdmFieldHandle* parent); + caf::PdmField* objectToggleField(caf::PdmObjectHandle* objectHandle); +}; + +} \ No newline at end of file diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiCommandSystemInterface.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiCommandSystemInterface.h index 89ebc8b453..99553257a9 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiCommandSystemInterface.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiCommandSystemInterface.h @@ -41,6 +41,7 @@ class QVariant; class QMenu; class QString; +class QWidget; namespace caf { @@ -53,6 +54,8 @@ class PdmUiCommandSystemInterface { public: virtual void fieldChangedCommand( const std::vector& fieldsToUpdate, const QVariant& newUiValue) = 0; + virtual void setCurrentContextMenuTargetWidget(QWidget* targetWidget) = 0; + virtual void populateMenuWithDefaultCommands(const QString& uiConfigName, QMenu* menu) = 0; }; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp index a60aa18910..a4e2385f01 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp @@ -145,6 +145,17 @@ void PdmUiCommandSystemProxy::setUiValueToField(PdmUiFieldHandle* uiFieldHandle, } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiCommandSystemProxy::setCurrentContextMenuTargetWidget(QWidget* targetWidget) +{ + if (m_commandInterface) + { + m_commandInterface->setCurrentContextMenuTargetWidget(targetWidget); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.h index 8d04ddb63e..d9744d0810 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.h @@ -39,6 +39,7 @@ class QVariant; class QMenu; class QString; +class QWidget; namespace caf { @@ -57,6 +58,7 @@ public: void setCommandInterface(PdmUiCommandSystemInterface* undoCommandInterface); void setUiValueToField(PdmUiFieldHandle* uiFieldHandle, const QVariant& newUiValue); + void setCurrentContextMenuTargetWidget(QWidget* targetWidget); void populateMenuWithDefaultCommands(const QString& uiConfigName, QMenu* menu); private: diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.cpp index 9f41be8f89..2ff803dc60 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldEditorHandle.cpp @@ -237,12 +237,15 @@ void PdmUiFieldEditorHandle::customMenuRequested(QPoint pos) } QMenu menu; + PdmUiCommandSystemProxy::instance()->setCurrentContextMenuTargetWidget(widget); objectHandle->uiCapability()->defineCustomContextMenu(uiField()->fieldHandle(), &menu, widget); if (!menu.actions().empty()) { menu.exec(globalPos); } + PdmUiCommandSystemProxy::instance()->setCurrentContextMenuTargetWidget(nullptr); + } } diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt b/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt index cdc1659b78..cfcb04d7b6 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt +++ b/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt @@ -17,6 +17,7 @@ set (MOC_HEADER_FILES # Resource file set( QRC_FILES + ${QRC_FILES} textedit.qrc ) @@ -76,6 +77,7 @@ if (USE_COMMAND_FRAMEWORK) set (TAP_LINK_LIBRARIES ${TAP_LINK_LIBRARIES} cafCommand + cafCommandFeatures ) endif(USE_COMMAND_FRAMEWORK) diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp b/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp index 4da3ac2b31..a76fc35c63 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp +++ b/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp @@ -45,6 +45,7 @@ #include #include #include +#include "cafCmdFeatureMenuBuilder.h" class DemoPdmObjectGroup : public caf::PdmDocument @@ -821,6 +822,14 @@ void MainWindow::createDockPanels() m_pdmUiTreeView = new caf::PdmUiTreeView(dockWidget); dockWidget->setWidget(m_pdmUiTreeView); + m_pdmUiTreeView->treeView()->setContextMenuPolicy(Qt::CustomContextMenu); + + QObject::connect(m_pdmUiTreeView->treeView(), + SIGNAL(customContextMenuRequested(const QPoint&)), + SLOT(slotCustomMenuRequestedForProjectTree(const QPoint&))); + + m_pdmUiTreeView->treeView()->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_pdmUiTreeView->enableSelectionManagerUpdating(true); addDockWidget(Qt::LeftDockWidgetArea, dockWidget); } @@ -1235,3 +1244,31 @@ void MainWindow::slotSaveProject() m_testRoot->writeFile(); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void MainWindow::slotCustomMenuRequestedForProjectTree(const QPoint&) +{ + QObject* senderObj = this->sender(); + QTreeView* treeView = dynamic_cast(senderObj); + if (treeView) + { + QMenu menu; + caf::CmdFeatureManager::instance()->setCurrentContextMenuTargetWidget(m_pdmUiTreeView); + + caf::CmdFeatureMenuBuilder menuBuilder; + + menuBuilder << "cafToggleItemsOnFeature"; + menuBuilder << "cafToggleItemsOffFeature"; + menuBuilder << "cafToggleItemsFeature"; + menuBuilder << "Separator"; + menuBuilder << "cafToggleItemsOnOthersOffFeature"; + + menuBuilder.appendToMenu(&menu); + + menu.exec(QCursor::pos()); + caf::CmdFeatureManager::instance()->setCurrentContextMenuTargetWidget(nullptr); + } + +} diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.h b/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.h index a71d571acc..fd6484dc52 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.h +++ b/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.h @@ -50,6 +50,8 @@ private slots: void slotLoadProject(); void slotSaveProject(); + void slotCustomMenuRequestedForProjectTree(const QPoint&); + private: static MainWindow* sm_mainWindowInstance; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp index 1ce4905e01..92158274a2 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp @@ -262,6 +262,8 @@ void PdmUiTreeViewEditor::customMenuRequested(QPoint pos) SelectionManager::instance()->setActiveChildArrayFieldHandle(this->currentChildArrayFieldHandle()); QMenu menu; + PdmUiCommandSystemProxy::instance()->setCurrentContextMenuTargetWidget(m_mainWidget->parentWidget()); + caf::PdmUiCommandSystemProxy::instance()->populateMenuWithDefaultCommands("PdmUiTreeViewEditor", &menu); if (menu.actions().size() > 0) @@ -271,6 +273,8 @@ void PdmUiTreeViewEditor::customMenuRequested(QPoint pos) menu.exec(globalPos); } + + PdmUiCommandSystemProxy::instance()->setCurrentContextMenuTargetWidget(nullptr); }