summaryrefslogtreecommitdiffstats
path: root/qt-ui/modeldelegates.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-14 11:50:38 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-14 11:53:24 -0700
commit70656cddead4eaf3382d16af7be4898a34cbdec1 (patch)
tree447f45680c86c35eb5e0e2b7aaf8de1d94c1094c /qt-ui/modeldelegates.cpp
parent44510f990bea4168827764c9ac85488995a59b97 (diff)
downloadsubsurface-70656cddead4eaf3382d16af7be4898a34cbdec1.tar.gz
Location completer: show candidate sites on the globe
As the user scrolls through the possible completions, show them on the globe as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/modeldelegates.cpp')
-rw-r--r--qt-ui/modeldelegates.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp
index 516ada3ce..268312a4d 100644
--- a/qt-ui/modeldelegates.cpp
+++ b/qt-ui/modeldelegates.cpp
@@ -11,6 +11,9 @@
#include "weightmodel.h"
#include "divetripmodel.h"
#include "qthelper.h"
+#ifndef NO_MARBLE
+#include "globe.h"
+#endif
#include <QCompleter>
#include <QKeyEvent>
@@ -520,6 +523,13 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem
free( (void*) gpsCoords);
}
+#ifndef NO_MARBLE
+ if ((option.state & QStyle::State_HasFocus) && dive_site_has_gps_location(ds)) {
+ qDebug() << "center on" << ds->name;
+ MainWindow::instance()->globe()->centerOnDiveSite(ds->uuid);
+ }
+#endif
+
if (dive_site_has_gps_location(ds) && dive_site_has_gps_location(&displayed_dive_site)) {
// so we are showing a completion and both the current dive site and the completion
// have a GPS fix... so let's show the distance