diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-07-16 18:08:08 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-07-16 18:33:57 -0700 |
commit | 56240cff5ba2e8b762d3ba85cf62aafdc874d693 (patch) | |
tree | e8ff7ed5a3ac98aeaa2f1a1fa1d8840a83b51369 /qt-ui | |
parent | 86bd9c7a90b9cced6fb5cee5faa21954d02f3662 (diff) | |
download | subsurface-56240cff5ba2e8b762d3ba85cf62aafdc874d693.tar.gz |
Show only 1 possibility if string is unique
We should only show one possibility if the dive_site name
string is unique - we don't have that dive_site yet - so
we pass to the Completer filter a Dummy string that will
surelly not be a dive site - konami code.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/modeldelegates.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp index f0f77ab67..404d329fc 100644 --- a/qt-ui/modeldelegates.cpp +++ b/qt-ui/modeldelegates.cpp @@ -22,6 +22,7 @@ #include <QFont> #include <QBrush> #include <QColor> +#include <QAbstractProxyModel> QSize DiveListDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { @@ -489,12 +490,14 @@ LocationFilterDelegate::LocationFilterDelegate(QObject *parent) { } -void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const +void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &origIdx) const { QFont fontBigger = qApp->font(); QFont fontSmaller = qApp->font(); QFontMetrics fmBigger(fontBigger); QStyleOptionViewItemV4 opt = option; + const QAbstractProxyModel *proxyModel = dynamic_cast<const QAbstractProxyModel*>(origIdx.model()); + QModelIndex index = proxyModel->mapToSource(origIdx); QStyledItemDelegate::initStyleOption(&opt, index); QBrush bg; QString diveSiteName = index.data().toString(); |