Qnx: Use ActionBuilder for Attach action

Change-Id: Ieb7fb38f1e293e61b7ca0e543e7066018cf32d5e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-01-17 15:43:46 +01:00
parent 03acd8f109
commit 164a6e7447

View File

@@ -32,6 +32,7 @@
#include <QAction>
using namespace Core;
using namespace ProjectExplorer;
namespace Qnx::Internal {
@@ -94,22 +95,22 @@ class QnxPlugin final : public ExtensionSystem::IPlugin
void extensionsInitialized() final
{
auto attachToQnxApplication = new QAction{Tr::tr("Attach to remote QNX application..."), this};
// Attach support
connect(attachToQnxApplication, &QAction::triggered, this, &showAttachToProcessDialog);
const Utils::Id QNX_DEBUGGING_GROUP = "Debugger.Group.Qnx";
QAction *debugSeparator = nullptr;
QAction *attachToQnxApplication = nullptr;
Core::ActionContainer *mstart = Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING);
ActionContainer *mstart = Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING);
mstart->appendGroup(QNX_DEBUGGING_GROUP);
mstart->addSeparator(Core::Context(Core::Constants::C_GLOBAL), QNX_DEBUGGING_GROUP,
&debugSeparator);
Core::Command *cmd = Core::ActionManager::registerAction
(attachToQnxApplication, "Debugger.AttachToQnxApplication");
mstart->addAction(cmd, QNX_DEBUGGING_GROUP);
// Attach support
ActionBuilder(this, "Debugger.AttachToQnxApplication")
.setText(Tr::tr("Attach to remote QNX application..."))
.addToContainer(ProjectExplorer::Constants::M_DEBUG_STARTDEBUGGING, QNX_DEBUGGING_GROUP)
.bindContextAction(&attachToQnxApplication)
.addOnTriggered(this, &showAttachToProcessDialog);
connect(KitManager::instance(), &KitManager::kitsChanged, this,
[attachToQnxApplication, debugSeparator] {