From d8a7da2c00d9b292e56f28cf2df4f191e6edce2c Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Fri, 12 Jan 2018 18:23:28 +0100 Subject: 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 --- src/location/maps/qgeomap.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/location/maps/qgeomap.cpp') 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 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 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 QGeoMapPrivate::mapObjects() const +{ + return QList(); +} + QT_END_NAMESPACE -- cgit v1.2.3