Callgrind: Remove superfluous action

Operate directly on m_startAction.

Change-Id: Ib86b2dfff664aeffa683f378d9e490a59f3f40a3
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2024-12-19 12:54:31 +01:00
parent ab27988186
commit 1285aff18a

View File

@@ -227,20 +227,17 @@ CallgrindTool::CallgrindTool(QObject *parent)
"Callgrind tool to record function calls when a program runs."); "Callgrind tool to record function calls when a program runs.");
if (!Utils::HostOsInfo::isWindowsHost()) { if (!Utils::HostOsInfo::isWindowsHost()) {
auto action = new QAction(Tr::tr("Valgrind Function Profiler"), this); m_startAction->setText(Tr::tr("Valgrind Function Profiler"));
action->setToolTip(toolTip); m_startAction->setParent(this);
menu->addAction(ActionManager::registerAction(action, CallgrindLocalActionId), m_startAction->setToolTip(toolTip);
menu->addAction(ActionManager::registerAction(m_startAction, CallgrindLocalActionId),
Debugger::Constants::G_ANALYZER_TOOLS); Debugger::Constants::G_ANALYZER_TOOLS);
QObject::connect(action, &QAction::triggered, this, [this, action] { QObject::connect(m_startAction, &QAction::triggered, this, [this] {
if (!Debugger::wantRunTool(OptimizedMode, action->text())) if (!Debugger::wantRunTool(OptimizedMode, m_startAction->text()))
return; return;
m_perspective.select(); m_perspective.select();
ProjectExplorerPlugin::runStartupProject(CALLGRIND_RUN_MODE); 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); auto action = new QAction(Tr::tr("Valgrind Function Profiler (External Application)"), this);