1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-15 10:48:33 +01:00

Start of event handling to capture keys with virtual function event()

This commit is contained in:
Andrew Udvare 2010-03-11 09:56:02 +00:00
parent f9711d414f
commit 116204d58e
2 changed files with 12 additions and 11 deletions

View File

@ -151,19 +151,19 @@ void ShortcutsDialog::CellClickedEvent() {
currentKey_ = keys_.at(ui_.table->currentRow()); currentKey_ = keys_.at(ui_.table->currentRow());
//TODO: Read setting and set correct radio button //TODO: Read setting and set correct radio button
// Disable ALL hotkey functionality built-in to Qt for this widget
/*
Where should this go?
If uncommented, and a cell is clicked, segfault
QKeyEvent* event;
GetShortcut(event);
*/
} }
void ShortcutsDialog::DefaultRadioClickedEvent() { void ShortcutsDialog::DefaultRadioClickedEvent() {
settings_.setValue(currentKey_, currentDefault_); settings_.setValue(currentKey_, currentDefault_);
} }
void ShortcutsDialog::GetShortcut(QKeyEvent* event) { bool ShortcutsDialog::event(QEvent* event) {
qDebug() << event->text(); if (event->type() == QEvent::ShortcutOverride) {
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
qDebug() << ke->text();
qDebug() << ke->key();
return true;
}
return QWidget::event(event);
} }

View File

@ -47,10 +47,11 @@ class ShortcutsDialog : public QDialog {
void ResetShortcuts(); void ResetShortcuts();
void SaveShortcuts(); void SaveShortcuts();
void CancelEvent(); void CancelEvent();
void GetShortcut(QKeyEvent* event); /*void GetShortcut(QKeyEvent* event);*/
void CellClickedEvent(); void CellClickedEvent();
void DefaultText(QString str); void DefaultText(QString str);
void DefaultRadioClickedEvent(); void DefaultRadioClickedEvent();
bool event(QEvent* event);
private: private:
Ui::ShortcutsDialog ui_; Ui::ShortcutsDialog ui_;