summaryrefslogtreecommitdiff
path: root/client/widgets/combobox.cc
diff options
context:
space:
mode:
authorsenator <elsenator@gmail.com>2011-12-01 15:58:45 +0100
committersenator <elsenator@gmail.com>2011-12-01 15:58:45 +0100
commitbf3029b893e7138593d2d185d4ce9de26491a15e (patch)
tree557cd81a1cd3f192346dca187f006f7814d8a5e3 /client/widgets/combobox.cc
parent9989ea2f6bfa19bd349bbbdec8ec3f56c1427245 (diff)
parent5ed7a801b4194e72cc3898de57fb1d9ea0e8caa4 (diff)
Merge branch 'master' of http://git.aasimon.org/public/pracro
Diffstat (limited to 'client/widgets/combobox.cc')
-rw-r--r--client/widgets/combobox.cc13
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);
}