diff --git a/src/shortcutsdialog.cpp b/src/shortcutsdialog.cpp index dfb9b9371..cf1d625c3 100644 --- a/src/shortcutsdialog.cpp +++ b/src/shortcutsdialog.cpp @@ -151,19 +151,19 @@ void ShortcutsDialog::CellClickedEvent() { currentKey_ = keys_.at(ui_.table->currentRow()); //TODO: Read setting and set correct radio button - - /* - Where should this go? - If uncommented, and a cell is clicked, segfault - QKeyEvent* event; - GetShortcut(event); - */ + // Disable ALL hotkey functionality built-in to Qt for this widget } void ShortcutsDialog::DefaultRadioClickedEvent() { settings_.setValue(currentKey_, currentDefault_); } -void ShortcutsDialog::GetShortcut(QKeyEvent* event) { - qDebug() << event->text(); +bool ShortcutsDialog::event(QEvent* event) { + if (event->type() == QEvent::ShortcutOverride) { + QKeyEvent *ke = static_cast(event); + qDebug() << ke->text(); + qDebug() << ke->key(); + return true; + } + return QWidget::event(event); } diff --git a/src/shortcutsdialog.h b/src/shortcutsdialog.h index 4556ba797..c96d6fb85 100644 --- a/src/shortcutsdialog.h +++ b/src/shortcutsdialog.h @@ -47,10 +47,11 @@ class ShortcutsDialog : public QDialog { void ResetShortcuts(); void SaveShortcuts(); void CancelEvent(); - void GetShortcut(QKeyEvent* event); + /*void GetShortcut(QKeyEvent* event);*/ void CellClickedEvent(); void DefaultText(QString str); void DefaultRadioClickedEvent(); + bool event(QEvent* event); private: Ui::ShortcutsDialog ui_; @@ -62,4 +63,4 @@ class ShortcutsDialog : public QDialog { QStringList keys_; }; -#endif // SHORTCUTSDIALOG_H \ No newline at end of file +#endif // SHORTCUTSDIALOG_H