diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-04-28 17:09:06 +0300 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-04-28 17:12:09 +0300 |
commit | ffb59864dc04e235c898465dbcb8250ff776a7c9 (patch) | |
tree | 851115758d23791fc5d1557d3eba37fd36519b4f /platform | |
parent | a9327c07e71639107afdde00798a1b6cfd0e53cd (diff) | |
download | qtlocation-mapboxgl-ffb59864dc04e235c898465dbcb8250ff776a7c9.tar.gz |
[Qt] s/mapRegionDidChange()/mapChanged(QMapboxGL::MapChange)/ signal
Diffstat (limited to 'platform')
-rw-r--r-- | platform/qt/include/qmapboxgl.hpp | 23 | ||||
-rw-r--r-- | platform/qt/src/qmapboxgl.cpp | 15 | ||||
-rw-r--r-- | platform/qt/src/qmapboxgl_p.hpp | 7 |
3 files changed, 27 insertions, 18 deletions
diff --git a/platform/qt/include/qmapboxgl.hpp b/platform/qt/include/qmapboxgl.hpp index 7a7389bfec..e7f363c05b 100644 --- a/platform/qt/include/qmapboxgl.hpp +++ b/platform/qt/include/qmapboxgl.hpp @@ -75,6 +75,7 @@ class Q_DECL_EXPORT QMapboxGL : public QObject Q_PROPERTY(double zoom READ zoom WRITE setZoom) Q_PROPERTY(double bearing READ bearing WRITE setBearing) Q_PROPERTY(double pitch READ pitch WRITE setPitch) + Q_ENUMS(MapChange) public: // Determines the orientation of the map. @@ -85,6 +86,24 @@ public: NorthLeftwards, }; + // Reflects mbgl::MapChange. + enum MapChange { + MapChangeRegionWillChange = 0, + MapChangeRegionWillChangeAnimated = 1, + MapChangeRegionIsChanging = 2, + MapChangeRegionDidChange = 3, + MapChangeRegionDidChangeAnimated = 4, + MapChangeWillStartLoadingMap = 5, + MapChangeDidFinishLoadingMap = 6, + MapChangeDidFailLoadingMap = 7, + MapChangeWillStartRenderingFrame = 8, + MapChangeDidFinishRenderingFrame = 9, + MapChangeDidFinishRenderingFrameFullyRendered = 10, + MapChangeWillStartRenderingMap = 11, + MapChangeDidFinishRenderingMap = 12, + MapChangeDidFinishRenderingMapFullyRendered = 13 + }; + QMapboxGL(QObject *parent = 0, const QMapboxGLSettings& = QMapboxGLSettings()); virtual ~QMapboxGL(); @@ -182,7 +201,7 @@ public slots: signals: void needsRendering(); - void mapRegionDidChange(); + void mapChanged(QMapboxGL::MapChange); private: Q_DISABLE_COPY(QMapboxGL) @@ -190,4 +209,6 @@ private: QMapboxGLPrivate *d_ptr; }; +Q_DECLARE_METATYPE(QMapboxGL::MapChange); + #endif // QMAPBOXGL_H diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index 01f0ad75af..5f580c6f36 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -584,9 +584,11 @@ QMapboxGLPrivate::QMapboxGLPrivate(QMapboxGL *q, const QMapboxGLSettings &settin static_cast<mbgl::GLContextMode>(settings.contextMode()), static_cast<mbgl::ConstrainMode>(settings.constrainMode()))) { + qRegisterMetaType<QMapboxGL::MapChange>("QMapboxGL::MapChange"); + fileSourceObj->setAccessToken(settings.accessToken().toStdString()); connect(this, SIGNAL(needsRendering()), q_ptr, SIGNAL(needsRendering()), Qt::QueuedConnection); - connect(this, SIGNAL(mapRegionDidChange()), q_ptr, SIGNAL(mapRegionDidChange())); + connect(this, SIGNAL(mapChanged(QMapboxGL::MapChange)), q_ptr, SIGNAL(mapChanged(QMapboxGL::MapChange)), Qt::QueuedConnection); } QMapboxGLPrivate::~QMapboxGLPrivate() @@ -619,16 +621,7 @@ void QMapboxGLPrivate::invalidate() void QMapboxGLPrivate::notifyMapChange(mbgl::MapChange change) { - // Map thread. - switch (change) { - case mbgl::MapChangeRegionDidChange: - case mbgl::MapChangeRegionDidChangeAnimated: - case mbgl::MapChangeRegionIsChanging: - emit mapRegionDidChange(); - break; - default: - break; - } + emit mapChanged(static_cast<QMapboxGL::MapChange>(change)); } void QMapboxGLPrivate::connectionEstablished() diff --git a/platform/qt/src/qmapboxgl_p.hpp b/platform/qt/src/qmapboxgl_p.hpp index c520073215..1e52f43363 100644 --- a/platform/qt/src/qmapboxgl_p.hpp +++ b/platform/qt/src/qmapboxgl_p.hpp @@ -11,11 +11,6 @@ #include <QObject> #include <QSize> -#include <memory> - -class QMapboxGL; -class QMapboxGLSettings; - class QMapboxGLPrivate : public QObject, public mbgl::View { Q_OBJECT @@ -50,8 +45,8 @@ public slots: void connectionEstablished(); signals: - void mapRegionDidChange(); void needsRendering(); + void mapChanged(QMapboxGL::MapChange); }; #endif // QMAPBOXGL_P_H |