diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2011-12-01 11:26:49 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2011-12-01 11:26:49 +0100 |
commit | 8dbc6ee0fbc1dd4485ec0ff1cf4a48e24b0b41a8 (patch) | |
tree | 8a2fc0817c7f89c2811324fb4b25370611a0de14 /client | |
parent | 728e74df239bac0f61faea062bb5a45340ee6d24 (diff) |
Make combobox selection list popup on spacebar or mousedown.
Diffstat (limited to 'client')
-rw-r--r-- | client/widgets/combobox.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc index eed2d10..935f620 100644 --- a/client/widgets/combobox.cc +++ b/client/widgets/combobox.cc @@ -93,6 +93,8 @@ ComboBox::ComboBox(QDomNode &node, MacroWindow *macrowindow) // Make empty default selection. combobox->setCurrentIndex(-1); + combobox->installEventFilter(this); + QDomElement elem = node.toElement(); combotype = SELECT; @@ -213,15 +215,26 @@ void ComboBox::changed() emit eventOnChange(); } +#include <QKeyEvent> bool ComboBox::eventFilter(QObject *obj, QEvent *event) { if(ignoreChangeEvents == true) return false; + if(combotype == SELECT) { if(event->type() == QEvent::MouseButtonRelease) { if(enabled()) combobox->showPopup(); } } + if(event->type() == QEvent::KeyPress) { + QKeyEvent *ke = (QKeyEvent*)event; + // printf("KEY: %d\n", ke->key()); + // if(ke->key() == Qt::Key_Up || ke->key() == Qt::Key_Down) { + if(ke->key() == Qt::Key_Space) { + if(enabled()) combobox->showPopup(); + } + } + return QObject::eventFilter(obj, event); } |