Better handling of keyboard on the inline edition on equipment

The handling of keyboard is broken on Qt inside QComboBoxes.
I'm trying ( and losing ) to make it less broken. This patch makes the
code work reasonably well if you press Key_down or Key_up after having
displayed the filter popup, which is different from the combobox popup for
some reason.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-03-19 18:29:35 -03:00 committed by Dirk Hohndel
parent 6ee3a6da52
commit 320071ac15

View file

@ -162,7 +162,10 @@ bool ComboBoxDelegate::eventFilter(QObject *object, QEvent *event)
QKeyEvent *ev = static_cast<QKeyEvent *>(event);
if (ev->key() == Qt::Key_Up || ev->key() == Qt::Key_Down) {
currCombo.ignoreSelection = true;
currCombo.comboEditor->showPopup();
if (!currCombo.comboEditor->completer()->popup()->isVisible()){
currCombo.comboEditor->showPopup();
return true;
}
}
if (ev->key() == Qt::Key_Tab || ev->key() == Qt::Key_Enter || ev->key() == Qt::Key_Return) {
currCombo.activeText = currCombo.comboEditor->currentText();