diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/globe.cpp | 20 | ||||
-rw-r--r-- | qt-ui/globe.h | 3 |
2 files changed, 21 insertions, 2 deletions
diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp index 846eabb1d..0dde6019c 100644 --- a/qt-ui/globe.cpp +++ b/qt-ui/globe.cpp @@ -38,6 +38,7 @@ GlobeGPS::GlobeGPS(QWidget* parent) : MarbleWidget(parent), loadedDives(0) foundGoogleMap = true; if (!foundGoogleMap) { subsurfaceDataPath = getSubsurfaceDataPath("marbledata"); + qDebug() << subsurfaceDataPath; if (subsurfaceDataPath != "") MarbleDirs::setMarbleDataPath(subsurfaceDataPath); } @@ -67,6 +68,25 @@ GlobeGPS::GlobeGPS(QWidget* parent) : MarbleWidget(parent), loadedDives(0) fixZoomTimer = new QTimer(); connect(fixZoomTimer, SIGNAL(timeout()), this, SLOT(fixZoom())); fixZoomTimer->setSingleShot(true); + installEventFilter(this); +} + +bool GlobeGPS::eventFilter(QObject *obj, QEvent *ev) +{ + // This disables Zooming when a double click occours on the scene. + if (ev->type() == QEvent::MouseButtonDblClick) + return true; + // This disables the Marble's Context Menu + // we need to move this to our 'contextMenuEvent' + // if we plan to do a different one in the future. + if (ev->type() == QEvent::ContextMenu) + return true; + if (ev->type() == QEvent::MouseButtonPress){ + QMouseEvent *e = static_cast<QMouseEvent*>(ev); + if(e->button() == Qt::RightButton) + return true; + } + return QObject::eventFilter(obj,ev ); } void GlobeGPS::mouseClicked(qreal lon, qreal lat, GeoDataCoordinates::Unit unit) diff --git a/qt-ui/globe.h b/qt-ui/globe.h index c44e9b591..b9cd398e3 100644 --- a/qt-ui/globe.h +++ b/qt-ui/globe.h @@ -20,11 +20,10 @@ public: void repopulateLabels(); void centerOn(struct dive* dive); void diveEditMode(); - + bool eventFilter(QObject*, QEvent*); protected: /* reimp */ void resizeEvent(QResizeEvent *event); /* reimp */ void mousePressEvent(QMouseEvent* event); - private: void prepareForGetDiveCoordinates(struct dive* dive); GeoDataDocument *loadedDives; |