From 1285aff18ab132ef040df2cc3cfba6eb82b8d008 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 19 Dec 2024 12:54:31 +0100 Subject: [PATCH] Callgrind: Remove superfluous action Operate directly on m_startAction. Change-Id: Ib86b2dfff664aeffa683f378d9e490a59f3f40a3 Reviewed-by: hjk --- src/plugins/valgrind/callgrindtool.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index 39b73ab491b..68306fee210 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -227,20 +227,17 @@ CallgrindTool::CallgrindTool(QObject *parent) "Callgrind tool to record function calls when a program runs."); if (!Utils::HostOsInfo::isWindowsHost()) { - auto action = new QAction(Tr::tr("Valgrind Function Profiler"), this); - action->setToolTip(toolTip); - menu->addAction(ActionManager::registerAction(action, CallgrindLocalActionId), + m_startAction->setText(Tr::tr("Valgrind Function Profiler")); + m_startAction->setParent(this); + m_startAction->setToolTip(toolTip); + menu->addAction(ActionManager::registerAction(m_startAction, CallgrindLocalActionId), Debugger::Constants::G_ANALYZER_TOOLS); - QObject::connect(action, &QAction::triggered, this, [this, action] { - if (!Debugger::wantRunTool(OptimizedMode, action->text())) + QObject::connect(m_startAction, &QAction::triggered, this, [this] { + if (!Debugger::wantRunTool(OptimizedMode, m_startAction->text())) return; m_perspective.select(); ProjectExplorerPlugin::runStartupProject(CALLGRIND_RUN_MODE); }); - QObject::connect(m_startAction, &QAction::triggered, action, &QAction::triggered); - QObject::connect(m_startAction, &QAction::changed, action, [action, this] { - action->setEnabled(m_startAction->isEnabled()); - }); } auto action = new QAction(Tr::tr("Valgrind Function Profiler (External Application)"), this);