diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2018-01-12 18:23:28 +0100 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2018-01-25 12:27:08 +0000 |
commit | d8a7da2c00d9b292e56f28cf2df4f191e6edce2c (patch) | |
tree | 8184e332c8836303100e906bfac183c16adaa58a /src/location/maps/qgeomap.cpp | |
parent | 3aca8077a21d4219b62a03bdc790a2019eb072cc (diff) |
Introduce QGeoMapObject
QGeoMapObject is a new class of map item, not deriving anymore from
QQuickItem, and designed to be more lightweight, and, most importantly,
to be easily backable by SDK-specific implementations, so to act as
an as thin as possible wrapper around those.
QGeoMapObject is intended to be the base class for this type of items.
This patch provides no mean to dynamically add/remove GeoMapObjects.
The intended way to do it is by using a MapObjectView, coming
initially with the Qt.labs.location extra plugin.
Change-Id: I8d6a45a4a32059c7ec4d904f75352e176bffda1e
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/maps/qgeomap.cpp')
-rw-r--r-- | src/location/maps/qgeomap.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/location/maps/qgeomap.cpp b/src/location/maps/qgeomap.cpp index fd03de01..529ebf82 100644 --- a/src/location/maps/qgeomap.cpp +++ b/src/location/maps/qgeomap.cpp @@ -39,6 +39,7 @@ #include "qgeocameracapabilities_p.h" #include "qgeomappingmanagerengine_p.h" #include "qdeclarativegeomapitembase_p.h" +#include "qgeomapobject_p.h" #include <QDebug> QT_BEGIN_NAMESPACE @@ -50,7 +51,10 @@ QGeoMap::QGeoMap(QGeoMapPrivate &dd, QObject *parent) QGeoMap::~QGeoMap() { + Q_D(QGeoMap); clearParameters(); + for (QGeoMapObject *p : d->mapObjects()) + p->setMap(nullptr); // forces replacing pimpls with the default ones. } void QGeoMap::setViewportSize(const QSize& size) @@ -231,6 +235,21 @@ void QGeoMap::clearMapItems() d->m_mapItems.clear(); } +/*! + Fills obj with a backend-specific pimpl. +*/ +bool QGeoMap::createMapObjectImplementation(QGeoMapObject *obj) +{ + Q_D(QGeoMap); + return d->createMapObjectImplementation(obj); +} + +QList<QGeoMapObject *> QGeoMap::mapObjects() const +{ + Q_D(const QGeoMap); + return d->mapObjects(); +} + QString QGeoMap::copyrightsStyleSheet() const { return QStringLiteral("#copyright-root { background: rgba(255, 255, 255, 128) }"); @@ -307,4 +326,15 @@ void QGeoMapPrivate::removeMapItem(QDeclarativeGeoMapItemBase *item) Q_UNUSED(item) } +bool QGeoMapPrivate::createMapObjectImplementation(QGeoMapObject *obj) +{ + Q_UNUSED(obj) + return false; +} + +QList<QGeoMapObject *> QGeoMapPrivate::mapObjects() const +{ + return QList<QGeoMapObject *>(); +} + QT_END_NAMESPACE |