Salome HOME
[bos #40644][CEA](2024-T1) Feature search.
authordish <dmitrii.shvydkoi@opencascade.com>
Wed, 13 Mar 2024 13:11:02 +0000 (13:11 +0000)
committerdish <dmitrii.shvydkoi@opencascade.com>
Wed, 13 Mar 2024 13:11:02 +0000 (13:11 +0000)
Change feature search shortcut.
Close feature search dialog if a feature is executed.

src/LightApp/resources/LightApp.xml
src/Qtx/QtxFindActionDialog.cxx
src/Qtx/QtxFindActionDialog.h

index bfaad0d7eec3d63224fe7f5d60a6fdcd5d9214ee..a5aafa55d669d088b3d9f8165b9fe66995bcaf0e 100644 (file)
     <parameter name="PRP_CREATE_NEW_WINDOW_FOR_VIEWER_5" value="Alt+C"/>
     <parameter name="PRP_CREATE_NEW_WINDOW_FOR_VIEWER_6" value="Alt+A"/>
     <parameter name="PRP_CREATE_NEW_WINDOW_FOR_VIEWER_7" value="Alt+Y"/>
-    <parameter name="PRP_DESK_FIND_ACTION" value="Ctrl+Space"/>
+    <parameter name="PRP_DESK_FIND_ACTION" value="Ctrl+Shift+Space"/>
     <parameter name="PRP_CREATE_NEW_WINDOW_FOR_VIEWER_8" value="Alt+3"/>
     <parameter name="#General/Object(s)/Show" value="Ctrl+Alt+S"/>
     <parameter name="#General/Object(s)/Hide" value="Ctrl+Alt+H"/>
index 6f903a1b186731db03ea973c06309739d02cfe3f..f631673bfe154673b01185ae9717e89b78eb3f6c 100644 (file)
@@ -60,7 +60,7 @@ QtxFindActionDialog::QtxFindActionDialog(QWidget* theParent)
   searchOptionsLayout->addWidget(myIncludeUnavailableActionsCB);
   searchOptionsLayout->addWidget(myIncludeInactiveModulesCB);
 
-  myFoundActionsTree = new QtxFoundActionTree();
+  myFoundActionsTree = new QtxFoundActionTree(this);
   layout->addWidget(myFoundActionsTree);
 
   connect(myQueryLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(onQueryChanged(const QString&)));
@@ -106,7 +106,8 @@ void QtxFindActionDialog::updateUI()
 
 
 
-QtxFoundActionTree::QtxFoundActionTree()
+QtxFoundActionTree::QtxFoundActionTree(QtxFindActionDialog* theParent)
+: QTreeWidget(theParent)
 {
   setColumnCount(2);
   setSelectionMode(QAbstractItemView::SingleSelection);
@@ -185,7 +186,8 @@ void QtxFoundActionTree::onItemDoubleClicked(QTreeWidgetItem* theItem, int theCo
   }
 
   QtxFoundActionTreeAction* const actionItem = static_cast<QtxFoundActionTreeAction*>(theItem);
-  actionItem->trigger();
+  if (actionItem->trigger())
+    static_cast<QtxFindActionDialog*>(parentWidget())->accept();
 }
 
 
@@ -332,11 +334,15 @@ bool QtxFoundActionTreeAction::isEnabled() const
   return std::find_if(actions.begin(), actions.end(), [](const QAction* const theAction){ return theAction->isEnabled(); }) != actions.end();
 }
 
-void QtxFoundActionTreeAction::trigger() const
+bool QtxFoundActionTreeAction::trigger() const
 {
+  bool res = false;
   const auto& actions = SUIT_ShortcutMgr::get()->getActions(myModuleID, myInModuleActionID);
   for (const auto& action : actions) {
-    if (action->isEnabled())
+    if (action->isEnabled()) {
       action->trigger();
+      res = true;
+    }
   }
+  return res;
 }
\ No newline at end of file
index c69fcca5d30afd6b5eb218a6145e2e03d411d87e..7632e2b299144d59cbd1d4a7f647fd6ae841cd8b 100644 (file)
@@ -89,7 +89,7 @@ public:
     ToolTip
   };
 
-  QtxFoundActionTree();
+  QtxFoundActionTree(QtxFindActionDialog* theParent);
   QtxFoundActionTree(const QtxFoundActionTree&) = delete;
   QtxFoundActionTree& operator=(const QtxFoundActionTree&) = delete;
   virtual ~QtxFoundActionTree() = default;
@@ -163,7 +163,7 @@ public:
 
   virtual bool isEnabled() const;
 
-  void trigger() const;
+  bool trigger() const;
 
   const QString myInModuleActionID;
 };