diff --git a/src/globalshortcuts/globalshortcutgrabber.cpp b/src/globalshortcuts/globalshortcutgrabber.cpp
index 41937d726..86862a40c 100644
--- a/src/globalshortcuts/globalshortcutgrabber.cpp
+++ b/src/globalshortcuts/globalshortcutgrabber.cpp
@@ -40,6 +40,10 @@ GlobalShortcutGrabber::GlobalShortcutGrabber(QWidget *parent)
ui_->setupUi(this);
modifier_keys_ << Qt::Key_Shift << Qt::Key_Control << Qt::Key_Meta << Qt::Key_Alt << Qt::Key_AltGr;
+
+ connect(ui_->buttonBox, SIGNAL(accepted()), this, SLOT(Accepted()));
+ connect(ui_->buttonBox, SIGNAL(rejected()), this, SLOT(Rejected()));
+
}
GlobalShortcutGrabber::~GlobalShortcutGrabber() {
@@ -48,8 +52,8 @@ GlobalShortcutGrabber::~GlobalShortcutGrabber() {
QKeySequence GlobalShortcutGrabber::GetKey(const QString &name) {
- ui_->label->setText(tr("Press a key combination to use for %1...").arg(name));
- ui_->combo->clear();
+ ui_->label_shortcut->setText(tr("Press a key combination to use for %1...").arg(name));
+ ui_->label_key->clear();
ret_ = QKeySequence();
@@ -102,5 +106,13 @@ bool GlobalShortcutGrabber::event(QEvent *e) {
}
void GlobalShortcutGrabber::UpdateText() {
- ui_->combo->setText("" + ret_.toString(QKeySequence::NativeText) + "");
+ ui_->label_key->setText("" + ret_.toString(QKeySequence::NativeText) + "");
+}
+
+void GlobalShortcutGrabber::Accepted() {
+ accept();
+}
+
+void GlobalShortcutGrabber::Rejected() {
+ if (ui_->label_key->text().isEmpty()) reject();
}
diff --git a/src/globalshortcuts/globalshortcutgrabber.h b/src/globalshortcuts/globalshortcutgrabber.h
index 9ca6c2661..7b8fe96f5 100644
--- a/src/globalshortcuts/globalshortcutgrabber.h
+++ b/src/globalshortcuts/globalshortcutgrabber.h
@@ -62,6 +62,10 @@ class GlobalShortcutGrabber : public QDialog {
void grabKeyboard();
void releaseKeyboard();
+private slots:
+ void Accepted();
+ void Rejected();
+
private:
void UpdateText();
void SetupMacEventHandler();
diff --git a/src/globalshortcuts/globalshortcutgrabber.ui b/src/globalshortcuts/globalshortcutgrabber.ui
index 7ee8195ae..00ffd013d 100644
--- a/src/globalshortcuts/globalshortcutgrabber.ui
+++ b/src/globalshortcuts/globalshortcutgrabber.ui
@@ -7,7 +7,7 @@
0
0
418
- 110
+ 123
@@ -19,7 +19,7 @@
-
-
+
Press a key combination to use for %1...
@@ -29,7 +29,7 @@
-
-
+
Qt::RichText
@@ -54,38 +54,5 @@
-
-
- buttonBox
- accepted()
- GlobalShortcutGrabber
- accept()
-
-
- 248
- 254
-
-
- 157
- 274
-
-
-
-
- buttonBox
- rejected()
- GlobalShortcutGrabber
- reject()
-
-
- 316
- 260
-
-
- 286
- 274
-
-
-
-
+