diff options
Diffstat (limited to 'client/widgets/button.cc')
-rw-r--r-- | client/widgets/button.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/client/widgets/button.cc b/client/widgets/button.cc index 6ef6ac8..06bf594 100644 --- a/client/widgets/button.cc +++ b/client/widgets/button.cc @@ -30,6 +30,7 @@ #include <QPushButton> #include "common.h" +#include "debug.h" #include "macrowindow.h" @@ -37,7 +38,7 @@ Button::Button(QDomNode &node, MacroWindow *macrowindow) : Widget(node, macrowindow) { button = new QPushButton(); - widget = button; + setWidget(button); setCommonAttributes(button, node); @@ -61,6 +62,17 @@ Button::Button(QDomNode &node, MacroWindow *macrowindow) connect(this, SIGNAL(act_cancel()), macrowindow, SLOT(cancel())); connect(macrowindow, SIGNAL(macroHasChanged()), this, SLOT(do_enable())); } + + if(elem.attribute("action") == "commit") { + QList<QKeySequence> lst; + lst << QKeySequence("Ctrl+Enter"); + lst << QKeySequence("Ctrl+Return"); + QAction *a = new QAction(widget_name, this); + a->setShortcuts(lst); + button->addAction(a); + connect(a, SIGNAL(triggered()), + this, SLOT(shortcutActivated())); + } } Button::~Button() @@ -82,3 +94,9 @@ void Button::do_enable() { button->setEnabled(true); } + +void Button::shortcutActivated() +{ + setKeyboardFocus(); + button->click(); +} |