From 8dbc6ee0fbc1dd4485ec0ff1cf4a48e24b0b41a8 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 1 Dec 2011 11:26:49 +0100 Subject: Make combobox selection list popup on spacebar or mousedown. --- client/widgets/combobox.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'client/widgets/combobox.cc') 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 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); } -- cgit v1.2.3