aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/General/hotkey/hotkeydialog.cpp19
-rw-r--r--src/plugins/General/hotkey/hotkeydialog.h10
2 files changed, 19 insertions, 10 deletions
diff --git a/src/plugins/General/hotkey/hotkeydialog.cpp b/src/plugins/General/hotkey/hotkeydialog.cpp
index 654b871e9..45a3c3e39 100644
--- a/src/plugins/General/hotkey/hotkeydialog.cpp
+++ b/src/plugins/General/hotkey/hotkeydialog.cpp
@@ -29,13 +29,10 @@ HotkeyDialog::HotkeyDialog(quint32 key, quint32 mod, QWidget *parent)
m_key = key;
m_modifiers = mod;
m_ui.keyLineEdit->setText(HotkeyManager::getKeyString(m_key, m_modifiers));
- grabKeyboard();
}
HotkeyDialog::~HotkeyDialog()
-{
- releaseKeyboard();
-}
+{}
void HotkeyDialog::keyPressEvent (QKeyEvent *event)
{
@@ -45,7 +42,12 @@ void HotkeyDialog::keyPressEvent (QKeyEvent *event)
m_modifiers &= ~mask_mod; //remove ignored modifiers (num lock, caps lock, etc)
m_ui.keyLineEdit->setText(HotkeyManager::getKeyString(m_key, m_modifiers));
- QWidget::keyPressEvent(event);
+ QDialog::keyPressEvent(event);
+}
+
+void HotkeyDialog::showEvent(QShowEvent *)
+{
+ grabKeyboard();
}
quint32 HotkeyDialog::nativeModifiers () const
@@ -65,5 +67,12 @@ void HotkeyDialog::accept()
m_key = 0;
m_modifiers = 0;
}
+ releaseKeyboard();
QDialog::accept();
}
+
+void HotkeyDialog::reject()
+{
+ releaseKeyboard();
+ QDialog::reject();
+}
diff --git a/src/plugins/General/hotkey/hotkeydialog.h b/src/plugins/General/hotkey/hotkeydialog.h
index 490539eac..4124e8c8f 100644
--- a/src/plugins/General/hotkey/hotkeydialog.h
+++ b/src/plugins/General/hotkey/hotkeydialog.h
@@ -41,15 +41,15 @@ public:
quint32 keySym () const;
public slots:
- virtual void accept();
-
-protected:
- virtual void keyPressEvent (QKeyEvent *event);
+ void accept();
+ void reject();
private:
+ void keyPressEvent (QKeyEvent *event);
+ void showEvent(QShowEvent *);
+
Ui::HotkeyDialog m_ui;
quint32 m_key, m_modifiers;
-
};
#endif