summaryrefslogtreecommitdiff
path: root/src/location
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-09-02 15:58:58 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-09-09 04:51:58 +0200
commitb6d3431ba621a1aabfd7d1ea3326bf503428a634 (patch)
treecf6daddc6d0cc39689ae56b8ca27134b3432e214 /src/location
parent76e21e0fd44b7841f1502eddf87147fa773685a0 (diff)
downloadqtlocation-b6d3431ba621a1aabfd7d1ea3326bf503428a634.tar.gz
Remove QDeclarativeGeoMapType wrapper
Register the QGeoMapType gadget directly as geoMapType (via a Foreign), and adapt QDeclarativeGeoMap to use it, simplifying the code. The type was uncreatable before, and is implicitly uncreatable as a value type now as well. QGeoMapType also needs to be registered as a namespace so that the MapStyle enum is available in QML. Pick-to: 6.2 Change-Id: Ibf0b26eb799005e4fabcbd5496d019da812c8d70 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/location')
-rw-r--r--src/location/CMakeLists.txt1
-rw-r--r--src/location/declarativemaps/qdeclarativegeomap.cpp109
-rw-r--r--src/location/declarativemaps/qdeclarativegeomap_p.h17
-rw-r--r--src/location/declarativemaps/qdeclarativegeomaptype.cpp161
-rw-r--r--src/location/declarativemaps/qdeclarativegeomaptype_p.h114
-rw-r--r--src/location/doc/src/plugins/osm.qdoc6
-rw-r--r--src/location/maps/qgeomaptype.cpp74
7 files changed, 123 insertions, 359 deletions
diff --git a/src/location/CMakeLists.txt b/src/location/CMakeLists.txt
index 68b0dd2c..81026c54 100644
--- a/src/location/CMakeLists.txt
+++ b/src/location/CMakeLists.txt
@@ -100,7 +100,6 @@ qt_internal_add_module(Location
declarativemaps/qdeclarativegeomapcopyrightsnotice.cpp
declarativemaps/qdeclarativegeoserviceprovider_p.h
declarativemaps/qdeclarativegeoserviceprovider.cpp
- declarativemaps/qdeclarativegeomaptype_p.h declarativemaps/qdeclarativegeomaptype.cpp
declarativemaps/qdeclarativegeomapparameter_p.h
declarativemaps/qdeclarativegeomapparameter.cpp
declarativemaps/qdeclarativegeomapitemview_p.h
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp
index 8a877cc8..53729934 100644
--- a/src/location/declarativemaps/qdeclarativegeomap.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomap.cpp
@@ -41,7 +41,6 @@
#include "qdeclarativegeomapquickitem_p.h"
#include "qdeclarativegeomapcopyrightsnotice_p.h"
#include "qdeclarativegeoserviceprovider_p.h"
-#include "qdeclarativegeomaptype_p.h"
#include "qgeomappingmanager_p.h"
#include "qgeocameracapabilities_p.h"
#include "qgeomap_p.h"
@@ -181,7 +180,6 @@ QDeclarativeGeoMap::QDeclarativeGeoMap(QQuickItem *parent)
: QQuickItem(parent),
m_plugin(0),
m_mappingManager(0),
- m_activeMapType(0),
m_gestureArea(new QQuickGeoMapGestureArea(this)),
m_map(0),
m_error(QGeoServiceProvider::NoError),
@@ -204,13 +202,13 @@ QDeclarativeGeoMap::QDeclarativeGeoMap(QQuickItem *parent)
setFlags(QQuickItem::ItemHasContents | QQuickItem::ItemClipsChildrenToShape);
setFiltersChildMouseEvents(true); // needed for childMouseEventFilter to work.
- m_activeMapType = new QDeclarativeGeoMapType(QGeoMapType(QGeoMapType::NoMap,
- tr("No Map"),
- tr("No Map"),
- false, false,
- 0,
- QByteArrayLiteral(""),
- QGeoCameraCapabilities()), this);
+ m_activeMapType = QGeoMapType(QGeoMapType::NoMap,
+ tr("No Map"),
+ tr("No Map"),
+ false, false,
+ 0,
+ QByteArrayLiteral(""),
+ QGeoCameraCapabilities());
m_cameraData.setCenter(QGeoCoordinate(51.5073,-0.1277)); //London city center
m_cameraData.setZoomLevel(8.0);
@@ -287,39 +285,15 @@ QDeclarativeGeoMap::~QDeclarativeGeoMap()
delete m_map; // map objects get reset here
}
-static QDeclarativeGeoMapType *findMapType(const QList<QDeclarativeGeoMapType *> &types, const QGeoMapType &type)
-{
- for (int i = 0; i < types.size(); ++i)
- if (types[i]->mapType() == type)
- return types[i];
- return nullptr;
-}
-
void QDeclarativeGeoMap::onSupportedMapTypesChanged()
{
- QList<QDeclarativeGeoMapType *> supportedMapTypes;
- QList<QGeoMapType> types = m_mappingManager->supportedMapTypes();
- for (int i = 0; i < types.size(); ++i) {
- // types that are present and get removed will be deleted at QObject destruction
- QDeclarativeGeoMapType *type = findMapType(m_supportedMapTypes, types[i]);
- if (!type)
- type = new QDeclarativeGeoMapType(types[i], this);
- supportedMapTypes.append(type);
- }
- m_supportedMapTypes.swap(supportedMapTypes);
+ m_supportedMapTypes = m_mappingManager->supportedMapTypes();
if (m_supportedMapTypes.isEmpty()) {
m_map->setActiveMapType(QGeoMapType()); // no supported map types: setting an invalid one
- } else {
- bool hasMapType = false;
- for (const auto *declarativeType : qAsConst(m_supportedMapTypes)) {
- if (declarativeType->mapType() == m_map->activeMapType())
- hasMapType = true;
- }
- if (!hasMapType) {
- QDeclarativeGeoMapType *type = m_supportedMapTypes.at(0);
- m_activeMapType = type;
- m_map->setActiveMapType(type->mapType());
- }
+ } else if (!m_supportedMapTypes.contains(m_map->activeMapType())) {
+ QGeoMapType type = m_supportedMapTypes.at(0);
+ m_activeMapType = type;
+ m_map->setActiveMapType(type);
}
emit supportedMapTypesChanged();
@@ -651,30 +625,23 @@ void QDeclarativeGeoMap::mappingManagerInitialized()
m_gestureArea->setMap(m_map);
- QList<QGeoMapType> types = m_mappingManager->supportedMapTypes();
- for (int i = 0; i < types.size(); ++i) {
- QDeclarativeGeoMapType *type = new QDeclarativeGeoMapType(types[i], this);
- m_supportedMapTypes.append(type);
- }
+ m_supportedMapTypes = m_mappingManager->supportedMapTypes();
- if (m_activeMapType && m_plugin->name().toLatin1() == m_activeMapType->mapType().pluginName()) {
- m_map->setActiveMapType(m_activeMapType->mapType());
+ if (m_activeMapType != QGeoMapType() && m_plugin->name().toLatin1() == m_activeMapType.pluginName()) {
+ m_map->setActiveMapType(m_activeMapType);
} else {
- if (m_activeMapType)
- m_activeMapType->deleteLater();
-
if (!m_supportedMapTypes.isEmpty()) {
- m_activeMapType = m_supportedMapTypes.at(0);
- m_map->setActiveMapType(m_activeMapType->mapType());
+ m_activeMapType = m_supportedMapTypes.at(0);
+ m_map->setActiveMapType(m_activeMapType);
} else {
- m_activeMapType = new QDeclarativeGeoMapType(QGeoMapType(QGeoMapType::NoMap,
- tr("No Map"),
- tr("No Map"),
- false,
- false,
- 0,
- QByteArrayLiteral(""),
- QGeoCameraCapabilities()), this);
+ m_activeMapType = QGeoMapType(QGeoMapType::NoMap,
+ tr("No Map"),
+ tr("No Map"),
+ false,
+ false,
+ 0,
+ QByteArrayLiteral(""),
+ QGeoCameraCapabilities());
}
}
@@ -1499,15 +1466,15 @@ QMargins QDeclarativeGeoMap::mapMargins() const
}
/*!
- \qmlproperty list<MapType> QtLocation::Map::supportedMapTypes
+ \qmlproperty list<mapType> QtLocation::Map::supportedMapTypes
- This read-only property holds the set of \l{MapType}{map types} supported by this map.
+ This read-only property holds the set of \l{mapType}{map types} supported by this map.
\sa activeMapType
*/
-QQmlListProperty<QDeclarativeGeoMapType> QDeclarativeGeoMap::supportedMapTypes()
+QList<QGeoMapType> QDeclarativeGeoMap::supportedMapTypes()
{
- return QQmlListProperty<QDeclarativeGeoMapType>(this, &m_supportedMapTypes);
+ return m_supportedMapTypes;
}
/*!
@@ -2261,21 +2228,21 @@ bool QDeclarativeGeoMap::addMapItemView_real(QDeclarativeGeoMapItemView *itemVie
}
/*!
- \qmlproperty MapType QtLocation::Map::activeMapType
+ \qmlproperty mapType QtLocation::Map::activeMapType
- \brief Access to the currently active \l{MapType}{map type}.
+ \brief Access to the currently active \l{mapType}{map type}.
- This property can be set to change the active \l{MapType}{map type}.
+ This property can be set to change the active \l{mapType}{map type}.
See the \l{Map::supportedMapTypes}{supportedMapTypes} property for possible values.
- \sa MapType
+ \sa mapType
*/
-void QDeclarativeGeoMap::setActiveMapType(QDeclarativeGeoMapType *mapType)
+void QDeclarativeGeoMap::setActiveMapType(const QGeoMapType &mapType)
{
- if (m_activeMapType->mapType() != mapType->mapType()) {
+ if (m_activeMapType != mapType) {
if (m_map) {
- if (mapType->mapType().pluginName() == m_plugin->name().toLatin1()) {
- m_map->setActiveMapType(mapType->mapType());
+ if (mapType.pluginName() == m_plugin->name().toLatin1()) {
+ m_map->setActiveMapType(mapType);
m_activeMapType = mapType;
emit activeMapTypeChanged();
}
@@ -2286,7 +2253,7 @@ void QDeclarativeGeoMap::setActiveMapType(QDeclarativeGeoMapType *mapType)
}
}
-QDeclarativeGeoMapType * QDeclarativeGeoMap::activeMapType() const
+QGeoMapType QDeclarativeGeoMap::activeMapType() const
{
return m_activeMapType;
}
diff --git a/src/location/declarativemaps/qdeclarativegeomap_p.h b/src/location/declarativemaps/qdeclarativegeomap_p.h
index 9f5d21c9..28e21491 100644
--- a/src/location/declarativemaps/qdeclarativegeomap_p.h
+++ b/src/location/declarativemaps/qdeclarativegeomap_p.h
@@ -65,14 +65,13 @@
#include <QtPositioning/qgeorectangle.h>
#include <QtLocation/private/qgeomap_p.h>
-Q_MOC_INCLUDE(<QtLocation/private/qdeclarativegeomaptype_p.h>)
Q_MOC_INCLUDE(<QtLocation/private/qdeclarativegeoserviceprovider_p.h>)
QT_BEGIN_NAMESPACE
class QQuickWindow;
class QDeclarativeGeoServiceProvider;
-class QDeclarativeGeoMapType;
+class QGeoMapType;
class QDeclarativeGeoMapCopyrightNotice;
class QDeclarativeGeoMapParameter;
@@ -96,8 +95,8 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoMap : public QQuickItem
Q_PROPERTY(qreal minimumFieldOfView READ minimumFieldOfView WRITE setMinimumFieldOfView NOTIFY minimumFieldOfViewChanged)
Q_PROPERTY(qreal maximumFieldOfView READ maximumFieldOfView WRITE setMaximumFieldOfView NOTIFY minimumFieldOfViewChanged)
- Q_PROPERTY(QDeclarativeGeoMapType *activeMapType READ activeMapType WRITE setActiveMapType NOTIFY activeMapTypeChanged)
- Q_PROPERTY(QQmlListProperty<QDeclarativeGeoMapType> supportedMapTypes READ supportedMapTypes NOTIFY supportedMapTypesChanged)
+ Q_PROPERTY(QGeoMapType activeMapType READ activeMapType WRITE setActiveMapType NOTIFY activeMapTypeChanged)
+ Q_PROPERTY(QList<QGeoMapType> supportedMapTypes READ supportedMapTypes NOTIFY supportedMapTypesChanged)
Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter NOTIFY centerChanged)
Q_PROPERTY(QList<QObject *> mapItems READ mapItems NOTIFY mapItemsChanged)
Q_PROPERTY(QList<QObject *> mapParameters READ mapParameters)
@@ -118,8 +117,8 @@ public:
void setPlugin(QDeclarativeGeoServiceProvider *plugin);
QDeclarativeGeoServiceProvider *plugin() const;
- void setActiveMapType(QDeclarativeGeoMapType *mapType);
- QDeclarativeGeoMapType *activeMapType() const;
+ void setActiveMapType(const QGeoMapType &mapType);
+ QGeoMapType activeMapType() const;
void setMinimumZoomLevel(qreal minimumZoomLevel, bool userSet = true);
qreal minimumZoomLevel() const;
@@ -166,7 +165,7 @@ public:
bool mapReady() const;
- QQmlListProperty<QDeclarativeGeoMapType> supportedMapTypes();
+ QList<QGeoMapType> supportedMapTypes();
Q_INVOKABLE void setBearing(qreal bearing, const QGeoCoordinate &coordinate);
Q_INVOKABLE void alignCoordinateToPoint(const QGeoCoordinate &coordinate, const QPointF &point);
@@ -297,8 +296,8 @@ private:
QQuickWindow *m_window = nullptr;
QDeclarativeGeoServiceProvider *m_plugin;
QGeoMappingManager *m_mappingManager;
- QDeclarativeGeoMapType *m_activeMapType;
- QList<QDeclarativeGeoMapType *> m_supportedMapTypes;
+ QGeoMapType m_activeMapType;
+ QList<QGeoMapType> m_supportedMapTypes;
QList<QDeclarativeGeoMapItemView *> m_mapViews;
QQuickGeoMapGestureArea *m_gestureArea;
QPointer<QGeoMap> m_map;
diff --git a/src/location/declarativemaps/qdeclarativegeomaptype.cpp b/src/location/declarativemaps/qdeclarativegeomaptype.cpp
deleted file mode 100644
index eb88a9b5..00000000
--- a/src/location/declarativemaps/qdeclarativegeomaptype.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtLocation module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativegeomaptype_p.h"
-#include <qnumeric.h>
-#include <QtQml/qqml.h>
-#include <QDebug>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype MapType
- \instantiates QDeclarativeGeoMapType
- \inherits QObject
- \inqmlmodule QtLocation
- \ingroup qml-QtLocation5-maps
- \since QtLocation 5.5
-
- \brief The MapType type holds information about a map type.
-
- This includes the map type's \l name and \l description, the \l style and
- a flag to indicate if the map type is optimized for mobile devices (\l mobile).
-*/
-
-QDeclarativeGeoMapType::QDeclarativeGeoMapType(const QGeoMapType &mapType, QObject *parent)
- : QObject(parent),
- mapType_(mapType),
- cameraCapabilities_(mapType.cameraCapabilities()) {}
-
-QDeclarativeGeoMapType::~QDeclarativeGeoMapType() {}
-
-/*!
- \qmlproperty enumeration MapType::style
-
- This read-only property gives access to the style of the map type.
-
- \list
- \li MapType.NoMap - No map.
- \li MapType.StreetMap - A street map.
- \li MapType.SatelliteMapDay - A map with day-time satellite imagery.
- \li MapType.SatelliteMapNight - A map with night-time satellite imagery.
- \li MapType.TerrainMap - A terrain map.
- \li MapType.HybridMap - A map with satellite imagery and street information.
- \li MapType.GrayStreetMap - A gray-shaded street map.
- \li MapType.PedestrianMap - A street map suitable for pedestriants.
- \li MapType.CarNavigationMap - A street map suitable for car navigation.
- \li MapType.CycleMap - A street map suitable for cyclists.
- \li MapType.CustomMap - A custom map type.
- \endlist
-*/
-QDeclarativeGeoMapType::MapStyle QDeclarativeGeoMapType::style() const
-{
- return QDeclarativeGeoMapType::MapStyle(mapType_.style());
-}
-
-/*!
- \qmlproperty string MapType::name
-
- This read-only property holds the name of the map type as a single formatted string.
-*/
-QString QDeclarativeGeoMapType::name() const
-{
- return mapType_.name();
-}
-
-/*!
- \qmlproperty string MapType::description
-
- This read-only property holds the description of the map type as a single formatted string.
-*/
-QString QDeclarativeGeoMapType::description() const
-{
- return mapType_.description();
-}
-
-/*!
- \qmlproperty bool MapType::mobile
-
- \brief Whether the map type is optimized for the use on a mobile device.
-
- Map types for mobile devices usually have higher constrast to counteract the
- effects of sunlight and a reduced color for improved readability.
-*/
-bool QDeclarativeGeoMapType::mobile() const
-{
- return mapType_.mobile();
-}
-
-/*!
- \qmlproperty bool MapType::night
- \since QtLocation 5.4
-
- \brief Whether the map type is optimized for use at night.
-
- Map types suitable for use at night usually have a dark background.
-*/
-bool QDeclarativeGeoMapType::night() const
-{
- return mapType_.night();
-}
-
-/*!
- \qmlproperty CameraCapabilities MapType::cameraCapabilities
- \since QtLocation 5.10
-
- This property holds the camera capabilities for this map type.
-*/
-QGeoCameraCapabilities QDeclarativeGeoMapType::cameraCapabilities() const
-{
- return cameraCapabilities_;
-}
-
-/*!
- \qmlproperty VariantMap MapType::metadata
- \since QtLocation 5.10
-
- This property holds optional, extra metadata related to a specific map type.
- The content of this property is entirely plugin-specific.
-*/
-QVariantMap QDeclarativeGeoMapType::metadata() const
-{
- return mapType_.metadata();
-}
-
-QT_END_NAMESPACE
diff --git a/src/location/declarativemaps/qdeclarativegeomaptype_p.h b/src/location/declarativemaps/qdeclarativegeomaptype_p.h
deleted file mode 100644
index 7ef96d7b..00000000
--- a/src/location/declarativemaps/qdeclarativegeomaptype_p.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtLocation module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVEGEOMAPTYPE_H
-#define QDECLARATIVEGEOMAPTYPE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLocation/private/qlocationglobal_p.h>
-
-#include <QtCore/QObject>
-#include <QtQml/qqml.h>
-#include <QtLocation/private/qgeomaptype_p.h>
-#include <QtLocation/private/qgeocameracapabilities_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoMapType : public QObject
-{
- Q_OBJECT
- Q_ENUMS(MapStyle)
-
- Q_PROPERTY(MapStyle style READ style CONSTANT)
- Q_PROPERTY(QString name READ name CONSTANT)
- Q_PROPERTY(QString description READ description CONSTANT)
- Q_PROPERTY(bool mobile READ mobile CONSTANT)
- Q_PROPERTY(bool night READ night CONSTANT REVISION 1)
- Q_PROPERTY(QGeoCameraCapabilities cameraCapabilities READ cameraCapabilities CONSTANT)
- Q_PROPERTY(QVariantMap metadata READ metadata CONSTANT)
-
-public:
- enum MapStyle {
- NoMap = QGeoMapType::NoMap,
- StreetMap = QGeoMapType::StreetMap,
- SatelliteMapDay = QGeoMapType::SatelliteMapDay,
- SatelliteMapNight = QGeoMapType::SatelliteMapNight,
- TerrainMap = QGeoMapType::TerrainMap,
- HybridMap = QGeoMapType::HybridMap,
- TransitMap = QGeoMapType::TransitMap,
- GrayStreetMap = QGeoMapType::GrayStreetMap,
- PedestrianMap = QGeoMapType::PedestrianMap,
- CarNavigationMap = QGeoMapType::CarNavigationMap,
- CycleMap = QGeoMapType::CycleMap,
- CustomMap = 100
- };
-
- QDeclarativeGeoMapType(const QGeoMapType &mapType, QObject *parent = 0);
- ~QDeclarativeGeoMapType();
-
- MapStyle style() const;
- QString name() const;
- QString description() const;
- bool mobile() const;
- bool night() const;
- QGeoCameraCapabilities cameraCapabilities() const;
- QVariantMap metadata() const;
-
- QGeoMapType mapType() const { return mapType_; }
-
-private:
- QGeoMapType mapType_;
- QGeoCameraCapabilities cameraCapabilities_;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QDeclarativeGeoMapType)
-
-#endif
diff --git a/src/location/doc/src/plugins/osm.qdoc b/src/location/doc/src/plugins/osm.qdoc
index 623ad0d1..b4b677d5 100644
--- a/src/location/doc/src/plugins/osm.qdoc
+++ b/src/location/doc/src/plugins/osm.qdoc
@@ -124,19 +124,19 @@ a prefix.
This value is the amount of cache to be used in addition to the bare minimum.
\row
\li osm.mapping.custom.datacopyright
- \li Custom data copryright string is used when setting the \l{Map::activeMapType} to \l{MapType}.CustomMap via urlprefix parameter.
+ \li Custom data copryright string is used when setting the \l{Map::activeMapType} to \l{mapType::style}{MapType.CustomMap} via urlprefix parameter.
This copyright will only be used when using the CustomMap from above. If empty no data copyright will be displayed for the custom map.
\row
\li osm.mapping.custom.host
\li Url string of a custom tile server. This parameter should be set to a valid server url offering the correct osm API.
To use this server, the \l{Map::activeMapType} parameter of the \l Map should be set to the supported map type
- whose type is \l{MapType}.CustomMap.
+ whose type is \l{mapType::style}{MapType.CustomMap}.
This map type is only be available if this plugin parameter is set, in which case it is
always \l{Map::supportedMapTypes}[supportedMapTypes.length - 1].
\note Setting the mapping.custom.host parameter to a new server renders the map tile cache useless for the old custommap style.
\row
\li osm.mapping.custom.mapcopyright
- \li Custom map copryright string is used when setting the \l{Map::activeMapType} to \l{MapType}.CustomMap via urlprefix parameter.
+ \li Custom map copryright string is used when setting the \l{Map::activeMapType} to \l{mapType::style}{MapType.CustomMap} via urlprefix parameter.
This copyright will only be used when using the CustomMap from above. If empty no map copyright will be displayed for the custom map.
\row
\li osm.mapping.highdpi_tiles
diff --git a/src/location/maps/qgeomaptype.cpp b/src/location/maps/qgeomaptype.cpp
index 7c3a50bc..dc5a5551 100644
--- a/src/location/maps/qgeomaptype.cpp
+++ b/src/location/maps/qgeomaptype.cpp
@@ -44,6 +44,18 @@ QT_BEGIN_NAMESPACE
QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QGeoMapTypePrivate)
+/*!
+ \qmltype mapType
+ \inqmlmodule QtLocation
+ \ingroup qml-QtLocation5-maps
+ \since QtLocation 5.5
+
+ \brief The mapType type holds information about a map type.
+
+ This includes the map type's \l name and \l description, the \l style and
+ a flag to indicate if the map type is optimized for mobile devices (\l mobile).
+*/
+
QGeoMapType::QGeoMapType()
: d_ptr(new QGeoMapTypePrivate()) {}
@@ -74,26 +86,74 @@ bool QGeoMapType::isEqual(const QGeoMapType &other) const noexcept
return (*d_ptr.constData() == *other.d_ptr.constData());
}
+/*!
+ \qmlproperty enumeration mapType::style
+
+ This read-only property gives access to the style of the map type.
+
+ \list
+ \li MapType.NoMap - No map.
+ \li MapType.StreetMap - A street map.
+ \li MapType.SatelliteMapDay - A map with day-time satellite imagery.
+ \li MapType.SatelliteMapNight - A map with night-time satellite imagery.
+ \li MapType.TerrainMap - A terrain map.
+ \li MapType.HybridMap - A map with satellite imagery and street information.
+ \li MapType.GrayStreetMap - A gray-shaded street map.
+ \li MapType.PedestrianMap - A street map suitable for pedestriants.
+ \li MapType.CarNavigationMap - A street map suitable for car navigation.
+ \li MapType.CycleMap - A street map suitable for cyclists.
+ \li MapType.CustomMap - A custom map type.
+ \endlist
+*/
+
QGeoMapType::MapStyle QGeoMapType::style() const
{
return d_ptr->style_;
}
+/*!
+ \qmlproperty string mapType::name
+
+ This read-only property holds the name of the map type as a single formatted string.
+*/
+
QString QGeoMapType::name() const
{
return d_ptr->name_;
}
+/*!
+ \qmlproperty string mapType::description
+
+ This read-only property holds the description of the map type as a single formatted string.
+*/
+
QString QGeoMapType::description() const
{
return d_ptr->description_;
}
+/*!
+ \qmlproperty bool mapType::mobile
+
+ \brief Whether the map type is optimized for the use on a mobile device.
+
+ Map types for mobile devices usually have higher constrast to counteract the
+ effects of sunlight and a reduced color for improved readability.
+*/
bool QGeoMapType::mobile() const
{
return d_ptr->mobile_;
}
+/*!
+ \qmlproperty bool mapType::night
+ \since QtLocation 5.4
+
+ \brief Whether the map type is optimized for use at night.
+
+ Map types suitable for use at night usually have a dark background.
+*/
bool QGeoMapType::night() const
{
return d_ptr->night_;
@@ -109,11 +169,25 @@ QByteArray QGeoMapType::pluginName() const
return d_ptr->pluginName_;
}
+/*!
+ \qmlproperty CameraCapabilities mapType::cameraCapabilities
+ \since QtLocation 5.10
+
+ This property holds the camera capabilities for this map type.
+*/
+
QGeoCameraCapabilities QGeoMapType::cameraCapabilities() const
{
return d_ptr->cameraCapabilities_;
}
+/*!
+ \qmlproperty VariantMap mapType::metadata
+ \since QtLocation 5.10
+
+ This property holds optional, extra metadata related to a specific map type.
+ The content of this property is entirely plugin-specific.
+*/
QVariantMap QGeoMapType::metadata() const
{
return d_ptr->metadata_;