From a28309b6bcdd4ee5ed31777473fd20eb805cac1a Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Mon, 24 Jan 2022 16:37:38 +0100 Subject: [PATCH] using same single instance of action searcher --- src/meshlab/mainwindow.h | 2 +- src/meshlab/mainwindow_Init.cpp | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/meshlab/mainwindow.h b/src/meshlab/mainwindow.h index 407391ee0..582d9ad38 100644 --- a/src/meshlab/mainwindow.h +++ b/src/meshlab/mainwindow.h @@ -359,7 +359,7 @@ public: QMenu* rasterLayerMenu() { return filterMenuRasterLayer; } private: - ActionSearcher wama; + ActionSearcher& searcher; //////// ToolBars /////////////// QToolBar* mainToolBar; QToolBar* decoratorToolBar; diff --git a/src/meshlab/mainwindow_Init.cpp b/src/meshlab/mainwindow_Init.cpp index 3d8bf9ba0..eb4a63a24 100644 --- a/src/meshlab/mainwindow_Init.cpp +++ b/src/meshlab/mainwindow_Init.cpp @@ -46,13 +46,14 @@ QProgressBar *MainWindow::qb; -MainWindow::MainWindow(): - httpReq(this), - gpumeminfo(NULL), - defaultGlobalParams(meshlab::defaultGlobalParameterList()), - lastUsedDirectory(QDir::home()), - PM(meshlab::pluginManagerInstance()), - _currviewcontainer(NULL) +MainWindow::MainWindow() : + searcher(meshlab::actionSearcherInstance()), + httpReq(this), + gpumeminfo(NULL), + defaultGlobalParams(meshlab::defaultGlobalParameterList()), + lastUsedDirectory(QDir::home()), + PM(meshlab::pluginManagerInstance()), + _currviewcontainer(NULL) { QSettings settings; //toDelete plugins, flagged in the last session @@ -650,7 +651,7 @@ void MainWindow::createMenus() { initSearchEngine(); int longest = longestActionWidthInAllMenus(); - searchMenu = new SearchMenu(wama, 15, searchButton, longest); + searchMenu = new SearchMenu(searcher, 15, searchButton, longest); searchButton->setMenu(searchMenu); connect(searchShortCut, SIGNAL(activated()), searchButton, SLOT(openMenu())); } @@ -658,22 +659,22 @@ void MainWindow::createMenus() void MainWindow::initSearchEngine() { - wama.clear(); + searcher.clear(); for (const auto& p : PM.filterPluginIterator()){ for (QAction* act : p->actions()) - wama.addAction(act); + searcher.addAction(act); } for (const auto& p : PM.editPluginFactoryIterator()){ for (QAction* act : p->actions()) - wama.addAction(act); + searcher.addAction(act); } for (const auto& p : PM.renderPluginIterator()){ for (QAction* act : p->actions()) - wama.addAction(act); + searcher.addAction(act); } for (const auto& p : PM.decoratePluginIterator()){ for (QAction* act : p->actions()) - wama.addAction(act); + searcher.addAction(act); } }