diff options
-rw-r--r-- | qt-ui/modeldelegates.cpp | 9 | ||||
-rw-r--r-- | qt-ui/modeldelegates.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp index 7ddfb9a16..9073ac158 100644 --- a/qt-ui/modeldelegates.cpp +++ b/qt-ui/modeldelegates.cpp @@ -95,8 +95,12 @@ QWidget *ComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewI comboDelegate->view()->setEditTriggers(QAbstractItemView::AllEditTriggers); comboDelegate->lineEdit()->installEventFilter(const_cast<QObject *>(qobject_cast<const QObject *>(this))); comboDelegate->view()->installEventFilter(const_cast<QObject *>(qobject_cast<const QObject *>(this))); + QAbstractItemView *comboPopup = comboDelegate->lineEdit()->completer()->popup(); + comboPopup->setMouseTracking(true); connect(comboDelegate, SIGNAL(highlighted(QString)), this, SLOT(testActivation(QString))); connect(comboDelegate, SIGNAL(activated(QString)), this, SLOT(fakeActivation())); + connect(comboPopup, SIGNAL(entered(QModelIndex)), this, SLOT(testActivation(QModelIndex))); + connect(comboPopup, SIGNAL(activated(QModelIndex)), this, SLOT(fakeActivation())); connect(this, SIGNAL(closeEditor(QWidget *, QAbstractItemDelegate::EndEditHint)), this, SLOT(fixTabBehavior())); currCombo.comboEditor = comboDelegate; currCombo.currRow = index.row(); @@ -126,6 +130,11 @@ void ComboBoxDelegate::testActivation(const QString &currText) setModelData(currCombo.comboEditor, currCombo.model, QModelIndex()); } +void ComboBoxDelegate::testActivation(const QModelIndex &currIndex) +{ + testActivation(currIndex.data().toString()); +} + // HACK, send a fake event so Qt thinks we hit 'enter' on the line edit. void ComboBoxDelegate::fakeActivation() { diff --git a/qt-ui/modeldelegates.h b/qt-ui/modeldelegates.h index d4060f940..e2b705e17 100644 --- a/qt-ui/modeldelegates.h +++ b/qt-ui/modeldelegates.h @@ -36,6 +36,7 @@ public: public slots: void testActivation(const QString &currString = QString()); + void testActivation(const QModelIndex &currIndex); //HACK: try to get rid of this in the future. void fakeActivation(); void fixTabBehavior(); |