Remove CommandButton

The same can be achieve with a factory method in `Command`, similar to
the existing ones for actions and buttons which synchronize their tool
tips with the shortcut.

Change-Id: I7e17654706b902dfa14f37b958fc2a60705d5cb5
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2024-01-25 08:59:18 +01:00
parent 34087df11e
commit acedf93ba3
14 changed files with 73 additions and 175 deletions

View File

@@ -8,7 +8,7 @@
#include "haskellmanager.h"
#include "haskelltr.h"
#include <coreplugin/actionmanager/commandbutton.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/coreplugintr.h>
#include <texteditor/textdocument.h>
@@ -23,8 +23,8 @@ namespace Haskell::Internal {
static QWidget *createEditorWidget()
{
auto widget = new TextEditorWidget;
auto ghciButton = new Core::CommandButton(Constants::A_RUN_GHCI, widget);
ghciButton->setText(Tr::tr("GHCi"));
auto ghciButton = Core::Command::createToolButtonWithShortcutToolTip(Constants::A_RUN_GHCI);
ghciButton->defaultAction()->setIconText(Tr::tr("GHCi"));
QObject::connect(ghciButton, &QToolButton::clicked, widget, [widget] {
openGhci(widget->textDocument()->filePath());
});