diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-04-24 15:17:30 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-04-25 07:19:18 -0700 |
commit | 0785a7f0cac3d1cf5b84e7f62407466c6798df34 (patch) | |
tree | bd6aad85737532d8e04590fdad7e8cc4cc6dc0b8 /qt-ui/modeldelegates.cpp | |
parent | 6fe692bde62ba0c33de006c64a7c5b857bcd4007 (diff) | |
download | subsurface-0785a7f0cac3d1cf5b84e7f62407466c6798df34.tar.gz |
Better handling of mouse on the delegates ( Equipment Edition )
This adds more handling of missing actions for the mouse on
the equipment edition. It complements the stuff talked about
on bug 359, but it's a different issue. 359 seems already fixed.
See #359
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/modeldelegates.cpp')
-rw-r--r-- | qt-ui/modeldelegates.cpp | 9 |
1 files changed, 9 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() { |