From: dish Date: Wed, 13 Mar 2024 13:11:02 +0000 (+0000) Subject: [bos #40644][CEA](2024-T1) Feature search. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b67800667afadce56227f293738197c9a7e53275;p=modules%2Fgui.git [bos #40644][CEA](2024-T1) Feature search. Change feature search shortcut. Close feature search dialog if a feature is executed. --- diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml index bfaad0d7e..a5aafa55d 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -285,7 +285,7 @@ - + diff --git a/src/Qtx/QtxFindActionDialog.cxx b/src/Qtx/QtxFindActionDialog.cxx index 6f903a1b1..f631673bf 100644 --- a/src/Qtx/QtxFindActionDialog.cxx +++ b/src/Qtx/QtxFindActionDialog.cxx @@ -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(theItem); - actionItem->trigger(); + if (actionItem->trigger()) + static_cast(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 diff --git a/src/Qtx/QtxFindActionDialog.h b/src/Qtx/QtxFindActionDialog.h index c69fcca5d..7632e2b29 100644 --- a/src/Qtx/QtxFindActionDialog.h +++ b/src/Qtx/QtxFindActionDialog.h @@ -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; };