summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-09-23 15:19:59 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-09-28 17:14:34 +0200
commit104e1bb73f19eff5ca5c136bdbcb99e2e4bc196b (patch)
tree4fb6da407bad9d9e69493980c5a069ab50eb248c
parent49a72acedbe4f66c94aca39f8ce9b2ea1e694366 (diff)
downloadqtlocation-104e1bb73f19eff5ca5c136bdbcb99e2e4bc196b.tar.gz
Build system: move to declarative type registration
Adjust the build system accordingly, attaching a QML module with the respective implementations to the QtLocation target. An explicit function is still needed to register converters, and will be removed once the improved support for value types has merged. This should enable the qml compiler to generate C++ code, which then requires linking against the library. The MapParameter type was renamed to DynamicMapParamter as per the 5.11 change log, so remove the MapParameter alias now and adjust tests. Task-number: QTBUG-106886 Change-Id: Id8765c1bc3b98d447d768b246b21a16f71bfdf74 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/imports/CMakeLists.txt1
-rw-r--r--src/imports/location/CMakeLists.txt13
-rw-r--r--src/imports/location/location.cpp278
-rw-r--r--src/imports/location/location.h148
-rw-r--r--src/location/CMakeLists.txt76
-rw-r--r--src/location/declarativemaps/qdeclarativegeocodemodel_p.h1
-rw-r--r--src/location/declarativemaps/qdeclarativegeomapparameter_p.h2
-rw-r--r--src/location/declarativemaps/qdeclarativegeoroute_p.h8
-rw-r--r--src/location/declarativemaps/qdeclarativegeoroutemodel_p.h10
-rw-r--r--src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h14
-rw-r--r--src/location/declarativeplaces/qdeclarativecategory_p.h2
-rw-r--r--src/location/declarativeplaces/qdeclarativecontactdetails_p.h5
-rw-r--r--src/location/declarativeplaces/qdeclarativeplace_p.h3
-rw-r--r--src/location/declarativeplaces/qdeclarativeplacecontentmodel_p.h10
-rw-r--r--src/location/declarativeplaces/qdeclarativesearchresultmodel_p.h4
-rw-r--r--src/location/declarativeplaces/qdeclarativesearchsuggestionmodel_p.h2
-rw-r--r--src/location/declarativeplaces/qdeclarativesupportedcategoriesmodel_p.h2
-rw-r--r--src/location/maps/qgeomaneuver.h9
-rw-r--r--src/location/maps/qgeomaptype_p.h13
-rw-r--r--src/location/maps/qgeoroute.h3
-rw-r--r--src/location/maps/qgeoroute_p.h2
-rw-r--r--src/location/maps/qgeoroutesegment.h2
-rw-r--r--src/location/places/qplaceattribute.h2
-rw-r--r--src/location/places/qplacecontactdetail.h2
-rw-r--r--src/location/places/qplaceicon.h2
-rw-r--r--src/location/places/qplaceratings.h2
-rw-r--r--src/location/places/qplacesupplier.h2
-rw-r--r--src/location/places/qplaceuser.h2
-rw-r--r--src/location/qlocation_quick.cpp127
-rw-r--r--src/location/quickmapitems/qdeclarativecirclemapitem_p.h4
-rw-r--r--src/location/quickmapitems/qdeclarativegeomap_p.h4
-rw-r--r--src/location/quickmapitems/qdeclarativegeomapcopyrightsnotice_p.h3
-rw-r--r--src/location/quickmapitems/qdeclarativegeomapitembase.cpp5
-rw-r--r--src/location/quickmapitems/qdeclarativegeomapitembase_p.h10
-rw-r--r--src/location/quickmapitems/qdeclarativegeomapitemgroup_p.h3
-rw-r--r--src/location/quickmapitems/qdeclarativegeomapitemview_p.h11
-rw-r--r--src/location/quickmapitems/qdeclarativegeomapquickitem_p.h2
-rw-r--r--src/location/quickmapitems/qdeclarativepolygonmapitem_p.h4
-rw-r--r--src/location/quickmapitems/qdeclarativepolylinemapitem_p.h6
-rw-r--r--src/location/quickmapitems/qdeclarativerectanglemapitem_p.h4
-rw-r--r--src/location/quickmapitems/qdeclarativeroutemapitem_p.h2
-rw-r--r--src/location/quickmapitems/qquickgeomapgesturearea_p.h8
-rw-r--r--tests/auto/declarative_location_core/tst_routing.qml6
-rw-r--r--tests/auto/declarative_ui/tst_map.qml2
45 files changed, 321 insertions, 501 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0dc84270..53e58dc7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,5 +2,4 @@
qt_feature_evaluate_features("${CMAKE_CURRENT_SOURCE_DIR}/configure.cmake")
add_subdirectory(location)
add_subdirectory(plugins)
-add_subdirectory(imports)
# special case end
diff --git a/src/imports/CMakeLists.txt b/src/imports/CMakeLists.txt
deleted file mode 100644
index 725edc35..00000000
--- a/src/imports/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-add_subdirectory(location)
diff --git a/src/imports/location/CMakeLists.txt b/src/imports/location/CMakeLists.txt
deleted file mode 100644
index 27db08a7..00000000
--- a/src/imports/location/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-qt_internal_add_qml_module(declarative_location
- URI QtLocation
- VERSION ${PROJECT_VERSION}
- PLUGIN_TARGET declarative_location
- NO_GENERATE_PLUGIN_SOURCE
- NO_PLUGIN_OPTIONAL
- CLASS_NAME QtLocationDeclarativeModule
- SOURCES
- location.h location.cpp
- LIBRARIES
- Qt::LocationPrivate
- Qt::Quick
-)
diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp
deleted file mode 100644
index d9a3b9a4..00000000
--- a/src/imports/location/location.cpp
+++ /dev/null
@@ -1,278 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 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 <QtLocation/private/qdeclarativegeoserviceprovider_p.h>
-#include <QtPositioningQuick/private/qdeclarativepluginparameter_p.h>
-#include <QtLocation/private/qdeclarativegeomap_p.h>
-
-#include <QtLocation/private/qdeclarativegeoroute_p.h>
-#include <QtLocation/private/qdeclarativegeoroutemodel_p.h>
-#include <QtLocation/private/qdeclarativegeocodemodel_p.h>
-#include <QtLocation/private/qdeclarativegeomapitembase_p.h>
-#include <QtLocation/private/qdeclarativegeomapquickitem_p.h>
-#include <QtLocation/private/qdeclarativegeomapitemview_p.h>
-#include <QtLocation/private/qdeclarativerectanglemapitem_p.h>
-#include <QtLocation/private/qdeclarativecirclemapitem_p.h>
-#include <QtLocation/private/qdeclarativeroutemapitem_p.h>
-#include <QtLocation/private/qdeclarativepolylinemapitem_p.h>
-#include <QtLocation/private/qdeclarativepolygonmapitem_p.h>
-#include <QtLocation/private/qdeclarativegeomapparameter_p.h>
-#include <QtLocation/private/qdeclarativegeomapcopyrightsnotice_p.h>
-#include <QtLocation/private/qdeclarativegeomapitemgroup_p.h>
-
-//Place includes
-#include <QtLocation/private/qdeclarativecategory_p.h>
-#include <QtLocation/private/qdeclarativeplace_p.h>
-#include <QtLocation/private/qdeclarativecontactdetails_p.h>
-
-#include <QtLocation/private/qdeclarativesupportedcategoriesmodel_p.h>
-#include <QtLocation/private/qdeclarativesearchresultmodel_p.h>
-#include <QtLocation/private/qdeclarativesearchsuggestionmodel_p.h>
-
-#include <QtQml/qqmlextensionplugin.h>
-
-#include <QtCore/QDebug>
-
-#include "location.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace {
-
-bool convertToGadget(const QMetaObject &metaObject, const QVariantMap &map, void *gadget)
-{
- for (auto &&[key, value] : map.asKeyValueRange()) {
- const int propIndex = metaObject.indexOfProperty(key.toUtf8());
- if (propIndex == -1) {
- qCritical("No property %s in %s", qPrintable(key), metaObject.className());
- return false;
- }
- const QMetaProperty prop = metaObject.property(propIndex);
- bool successfulWrite = false;
- if (value.metaType() != prop.metaType()) {
- QVariant coercedValue = value;
- if (!coercedValue.convert(prop.metaType())) {
- qCritical("Could not convert value from %s to %s for property %s::%s",
- value.typeName(), prop.typeName(), metaObject.className(), qPrintable(key));
- return false;
- }
- successfulWrite = prop.writeOnGadget(gadget, coercedValue);
- } else {
- successfulWrite = prop.writeOnGadget(gadget, value);
- }
- if (!successfulWrite) {
- qCritical("Could not set property %s on %s", qPrintable(key), metaObject.className());
- return false;
- }
- }
- return true;
-}
-
-template<typename SourceType, typename GadgetType>
-bool converterToGadget(const void *src, void *gadget)
-{
- const QMetaObject &metaObject = GadgetType::staticMetaObject;
- QVariantMap variantMap;
- if constexpr (std::is_same_v<SourceType, QJSValue>) {
- const QJSValue &jsValue = *static_cast<const QJSValue *>(src);
- const QVariant &variant = jsValue.toVariant();
- if (variant.metaType() != QMetaType::fromType<QVariantMap>())
- return false;
- variantMap = variant.toMap();
- } else {
- static_assert(std::is_same_v<SourceType, QVariantMap>);
- variantMap = *static_cast<const QVariantMap *>(src);
- }
- return convertToGadget(metaObject, variantMap, gadget);
-}
-
-template<typename GadgetType>
-bool registerConverterToGadget()
-{
- if (!QMetaType::registerConverterFunction(converterToGadget<QJSValue, GadgetType>,
- QMetaType::fromType<QJSValue>(), QMetaType::fromType<GadgetType>())) {
- qCritical("Failed to register conversion function from QJSValue to %s",
- GadgetType::staticMetaObject.className());
- return false;
- }
- if (!QMetaType::registerConverterFunction(converterToGadget<QVariantMap, GadgetType>,
- QMetaType::fromType<QVariantMap>(), QMetaType::fromType<GadgetType>())) {
- qCritical("Failed to register conversion function from QVariantMap to %s",
- GadgetType::staticMetaObject.className());
- return false;
- }
-
- return true;
-}
-
-} // anonymous namespace
-
-class QtLocationDeclarativeModule: public QQmlExtensionPlugin
-{
- Q_OBJECT
-
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
-
-public:
- QtLocationDeclarativeModule(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
- void registerTypes(const char *uri) override
- {
- if (QLatin1String(uri) == QLatin1String("QtLocation")) {
-
- // @uri QtLocation
- int major = 5;
- int minor = 0;
-
- // Register the 5.0 types
- // 5.0 is silent and not advertised
-
- qmlRegisterType<QDeclarativeGeoServiceProvider >(uri, major, minor, "Plugin");
- qmlRegisterType<QDeclarativePluginParameter >(uri, major, minor, "PluginParameter");
- qmlRegisterUncreatableType<QDeclarativeGeoServiceProviderRequirements>(uri, major, minor, "PluginRequirements",
- QStringLiteral("PluginRequirements is not intended instantiable by developer."));
- qmlRegisterType<QDeclarativeGeoMap >(uri, major, minor, "Map");
-
- qmlRegisterUncreatableType<QDeclarativeGeoMapItemBase >(uri, major, minor, "GeoMapItemBase",
- QStringLiteral("GeoMapItemBase is not intended instantiable by developer."));
- qmlRegisterType<QDeclarativeGeoMapQuickItem >(uri, major, minor, "MapQuickItem");
- qmlRegisterType<QDeclarativeGeoMapItemView >(uri, major, minor, "MapItemView");
-
- qmlRegisterType<QDeclarativeGeocodeModel >(uri, major, minor, "GeocodeModel"); // geocoding and reverse geocoding
- qmlRegisterType<QDeclarativeGeoRouteModel >(uri, major, minor, "RouteModel");
- qmlRegisterType<QDeclarativeGeoRouteQuery >(uri, major, minor, "RouteQuery");
- qmlRegisterType<QDeclarativeGeoRoute >(uri, major, minor, "Route"); // data type
- qmlRegisterUncreatableType<QGeoMapPinchEvent >(uri, major, minor, "MapPinchEvent",
- QStringLiteral("(Map)PinchEvent is not intended instantiable by developer."));
- qmlRegisterUncreatableType<QQuickGeoMapGestureArea>(uri, major, minor, "MapGestureArea",
- QStringLiteral("(Map)GestureArea is not intended instantiable by developer."));
- qmlRegisterType<QDeclarativeCategory >(uri, major, minor, "Category");
- qmlRegisterType<QDeclarativePlaceEditorialModel >(uri, major, minor, "EditorialModel");
- qmlRegisterType<QDeclarativePlaceImageModel >(uri, major, minor, "ImageModel");
- qmlRegisterType<QDeclarativePlace >(uri, major, minor, "Place");
- qmlRegisterType<QDeclarativePlaceReviewModel >(uri, major, minor, "ReviewModel");
- qmlRegisterType<QDeclarativeRectangleMapItem >(uri, major, minor, "MapRectangle");
- qmlRegisterType<QDeclarativeCircleMapItem >(uri, major, minor, "MapCircle");
- qmlRegisterAnonymousType<QDeclarativeMapLineProperties >(uri, major);
- qmlRegisterType<QDeclarativePolylineMapItem >(uri, major, minor, "MapPolyline");
- qmlRegisterType<QDeclarativePolygonMapItem >(uri, major, minor, "MapPolygon");
- qmlRegisterType<QDeclarativeRouteMapItem >(uri, major, minor, "MapRoute");
-
- qmlRegisterType<QDeclarativeSupportedCategoriesModel >(uri, major, minor, "CategoryModel");
- qmlRegisterType<QDeclarativeSearchResultModel >(uri, major, minor, "PlaceSearchModel");
- qmlRegisterType<QDeclarativeSearchSuggestionModel >(uri, major, minor, "PlaceSearchSuggestionModel");
- qmlRegisterUncreatableType<QQmlPropertyMap >(uri, major, minor, "ExtendedAttributes", "ExtendedAttributes instances cannot be instantiated. "
- "Only Place types have ExtendedAttributes and they cannot be re-assigned "
- "(but can be modified).");
- qmlRegisterUncreatableType<QDeclarativeContactDetails >(uri, major, minor, "ContactDetails", "ContactDetails instances cannot be instantiated. "
- "Only Place types have ContactDetails and they cannot "
- "be re-assigned (but can be modified).");
-
- // Introduction of 5.3 version; existing 5.0 exports automatically become available under 5.3 as well
- // 5.3 is committed QML API despite missing release of QtLocation 5.3
-
- minor = 6;
- //TODO: this is broken QTBUG-50990
- qmlRegisterUncreatableType<QQuickGeoMapGestureArea, 1>(uri, major, minor, "MapGestureArea",
- QStringLiteral("(Map)GestureArea is not intended instantiable by developer."));
-
- // Register the 5.8 types
-
- // Register the 5.9 types
- minor = 9;
- qmlRegisterType<QDeclarativeGeoMapParameter>(uri, major, minor, "MapParameter");
- qmlRegisterType<QDeclarativeGeoMapCopyrightNotice>(uri, major, minor, "MapCopyrightNotice");
- qmlRegisterType<QDeclarativeGeoMapItemGroup>(uri, major, minor, "MapItemGroup");
-
- // Register the 5.11 types
- minor = 11;
- qmlRegisterType<QDeclarativeGeoMap, 11>(uri, major, minor, "Map");
- qmlRegisterUncreatableType<QDeclarativeGeoMapItemBase, 11>(uri, major, minor, "GeoMapItemBase",
- QStringLiteral("GeoMapItemBase is not intended instantiable by developer."));
- qmlRegisterType<QDeclarativeGeoMapParameter>(uri, major, minor, "DynamicParameter");
- qmlRegisterType<QDeclarativeGeoRoute, 11>(uri, major, minor, "Route");
- qmlRegisterType<QDeclarativeGeoRouteQuery, 11>(uri, major, minor, "RouteQuery");
- qmlRegisterType<QDeclarativeGeoServiceProvider, 11>(uri, major, minor, "Plugin");
- qmlRegisterType<QDeclarativeGeoWaypoint>(uri, major, minor, "Waypoint");
-
- // Register the 5.12 types
- minor = 12;
- qmlRegisterType<QDeclarativeGeoMapItemView, 12>(uri, major, minor, "MapItemView");
- qmlRegisterType<QDeclarativeSearchResultModel, 12>(uri, major, minor, "PlaceSearchModel");
- qmlRegisterType<QDeclarativeGeoMap, 12>(uri, major, minor, "Map");
- qmlRegisterType<QDeclarativeGeoRoute, 12>(uri, major, minor, "Route");
-
- minor = 13;
- qmlRegisterType<QDeclarativeGeoMap, 13>(uri, major, minor, "Map");
- qmlRegisterType<QDeclarativeGeoRoute, 13>(uri, major, minor, "Route");
- qmlRegisterType<QDeclarativeGeoRouteQuery, 13>(uri, major, minor, "RouteQuery");
-
- minor = 14;
- qmlRegisterType<QDeclarativeGeoMap, 14>(uri, major, minor, "Map");
- qmlRegisterUncreatableType<QDeclarativeGeoMapItemBase, 14>(uri, major, minor, "GeoMapItemBase",
- QStringLiteral("GeoMapItemBase is not intended instantiable by developer."));
-
- minor = 15;
- qmlRegisterType<QDeclarativePolylineMapItem, 15>(uri, major, minor, "MapPolyline");
- qmlRegisterType<QDeclarativePolygonMapItem, 15>(uri, major, minor, "MapPolygon");
- qmlRegisterType<QDeclarativeRectangleMapItem, 15>(uri, major, minor, "MapRectangle");
- qmlRegisterType<QDeclarativeCircleMapItem, 15>(uri, major, minor, "MapCircle");
- qmlRegisterUncreatableType<QDeclarativeGeoMapItemBase, 15>(uri, major, minor, "GeoMapItemBase",
- QStringLiteral("GeoMapItemBase is not intended instantiable by developer."));
-
- // The minor version used to be the current Qt 5 minor. For compatibility it is the last
- // Qt 5 release.
- qmlRegisterModule(uri, 5, 15);
-
- //registrations below are version independent
- qRegisterMetaType<QPlaceCategory>();
- qRegisterMetaType<QPlace>();
-
- registerConverterToGadget<QPlaceRatings>();
- registerConverterToGadget<QPlaceIcon>();
- registerConverterToGadget<QPlaceSupplier>();
- } else {
- qDebug() << "Unsupported URI given to load location QML plugin: " << QLatin1String(uri);
- }
- }
-};
-
-QT_END_NAMESPACE
-
-#include "location.moc"
-#include "moc_location.cpp"
diff --git a/src/imports/location/location.h b/src/imports/location/location.h
deleted file mode 100644
index 375c0855..00000000
--- a/src/imports/location/location.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 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 QTLOCATION_QMLTYPES_H
-#define QTLOCATION_QMLTYPES_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 <QGeoManeuver>
-#include <QGeoRouteSegment>
-#include <QPlaceAttribute>
-#include <QPlaceContactDetail>
-#include <QPlaceUser>
-#include <QPlaceSupplier>
-#include <QPlaceRatings>
-#include <QPlaceIcon>
-
-#include <QtLocation/private/qgeomaptype_p.h>
-
-#include <QtQml/qqml.h>
-
-QT_BEGIN_NAMESPACE
-
-struct QGeoManeuverForeign
-{
- Q_GADGET
- QML_FOREIGN(QGeoManeuver)
- QML_NAMED_ELEMENT(routeManeuver)
-};
-
-namespace QGeoManeuverForeignNamespace
-{
- Q_NAMESPACE
- QML_FOREIGN_NAMESPACE(QGeoManeuver)
- QML_NAMED_ELEMENT(RouteManeuver)
-};
-
-struct QGeoRouteSegmentForeign
-{
- Q_GADGET
- QML_FOREIGN(QGeoRouteSegment)
- QML_NAMED_ELEMENT(routeSegment)
-};
-
-struct QGeoMapTypeForeign
-{
- Q_GADGET
- QML_FOREIGN(QGeoMapType)
- QML_NAMED_ELEMENT(mapType)
-};
-
-namespace QGeoMapTypeForeignNamespace
-{
- Q_NAMESPACE
- QML_FOREIGN_NAMESPACE(QGeoMapType)
- QML_NAMED_ELEMENT(MapType)
-};
-
-struct QPlaceUserForeign
-{
- Q_GADGET
- QML_FOREIGN(QPlaceUser)
- QML_NAMED_ELEMENT(user)
-};
-
-struct QPlaceRatingsForeign
-{
- Q_GADGET
- QML_FOREIGN(QPlaceRatings)
- QML_NAMED_ELEMENT(ratings)
-};
-
-struct QPlaceAttributeForeign
-{
- Q_GADGET
- QML_FOREIGN(QPlaceAttribute)
- QML_NAMED_ELEMENT(placeAttribute)
-};
-
-struct QPlaceIconForeign
-{
- Q_GADGET
- QML_FOREIGN(QPlaceIcon)
- QML_NAMED_ELEMENT(icon)
-};
-
-struct QPlaceSupplierForeign
-{
- Q_GADGET
- QML_FOREIGN(QPlaceSupplier)
- QML_NAMED_ELEMENT(supplier)
-};
-
-struct QPlaceContactDetailForeign
-{
- Q_GADGET
- QML_FOREIGN(QPlaceContactDetail)
- QML_NAMED_ELEMENT(contactDetail)
-};
-
-QT_END_NAMESPACE
-
-#endif // QTLOCATION_QMLTYPES_H
diff --git a/src/location/CMakeLists.txt b/src/location/CMakeLists.txt
index bf921f79..38f46485 100644
--- a/src/location/CMakeLists.txt
+++ b/src/location/CMakeLists.txt
@@ -69,6 +69,56 @@ qt_internal_add_module(Location
places/qplaceratings.h places/qplaceratings_p.h places/qplaceratings.cpp
places/qplacecontactdetail.h places/qplacecontactdetail_p.h places/qplacecontactdetail.cpp
places/qplacecontent.h places/qplacecontent_p.h places/qplacecontent.cpp
+ INCLUDE_DIRECTORIES
+ maps
+ places
+ declarativemaps
+ declarativeplaces
+ quickmapitems
+ ../3rdparty/earcut
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::QuickPrivate
+ Qt::PositioningPrivate
+ Qt::PositioningQuickPrivate
+ Qt::Qml
+ Qt::Quick
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::Positioning
+ Qt::PositioningQuick
+ PRIVATE_MODULE_INTERFACE
+ Qt::CorePrivate
+ Qt::QuickPrivate
+ Qt::PositioningPrivate
+ Qt::PositioningQuickPrivate
+ DEFINES
+ QT_NO_FOREACH
+ GENERATE_CPP_EXPORTS
+ GENERATE_PRIVATE_CPP_EXPORTS
+)
+
+qt_internal_add_qml_module(Location
+ URI QtLocation
+ VERSION ${PROJECT_VERSION}
+ PLUGIN_TARGET declarative_location
+ NO_PLUGIN_OPTIONAL
+ CLASS_NAME QtLocationDeclarativeModule
+ SOURCES
+ qlocation_quick.cpp
+ # value types
+ maps/qgeomaptype_p.h
+ maps/qgeomaneuver.h
+ maps/qgeoroute.h
+ maps/qgeoroutesegment.h
+ places/qplaceattribute.h
+ places/qplacecontactdetail.h
+ places/qplaceicon.h
+ places/qplaceratings.h
+ places/qplacesupplier.h
+ places/qplaceuser.h
+ # Element types
declarativemaps/qdeclarativegeoserviceprovider_p.h
declarativemaps/qdeclarativegeoserviceprovider.cpp
declarativemaps/qdeclarativegeomapparameter_p.h
@@ -122,34 +172,8 @@ qt_internal_add_module(Location
declarativeplaces/qdeclarativesearchsuggestionmodel_p.h
declarativeplaces/qdeclarativesupportedcategoriesmodel.cpp
declarativeplaces/qdeclarativesupportedcategoriesmodel_p.h
- INCLUDE_DIRECTORIES
- maps
- places
- declarativemaps
- declarativeplaces
- quickmapitems
- ../3rdparty/earcut
- LIBRARIES
- Qt::CorePrivate
- Qt::Gui
- Qt::QuickPrivate
- Qt::PositioningPrivate
- Qt::PositioningQuickPrivate
- Qt::Qml
- PUBLIC_LIBRARIES
- Qt::Core
- Qt::Positioning
- Qt::Network
- Qt::PositioningQuick
- PRIVATE_MODULE_INTERFACE
- Qt::CorePrivate
- Qt::QuickPrivate
- Qt::PositioningPrivate
- Qt::PositioningQuickPrivate
DEFINES
QT_NO_FOREACH
- GENERATE_CPP_EXPORTS
- GENERATE_PRIVATE_CPP_EXPORTS
)
qt_internal_add_shaders(Location "declarative_location_shaders"
diff --git a/src/location/declarativemaps/qdeclarativegeocodemodel_p.h b/src/location/declarativemaps/qdeclarativegeocodemodel_p.h
index 95385fb1..77eb6932 100644
--- a/src/location/declarativemaps/qdeclarativegeocodemodel_p.h
+++ b/src/location/declarativemaps/qdeclarativegeocodemodel_p.h
@@ -73,6 +73,7 @@ class QDeclarativeGeoLocation;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeocodeModel : public QAbstractListModel, public QQmlParserStatus
{
Q_OBJECT
+ QML_NAMED_ELEMENT(GeocodeModel)
Q_ENUMS(Status)
Q_ENUMS(GeocodeError)
diff --git a/src/location/declarativemaps/qdeclarativegeomapparameter_p.h b/src/location/declarativemaps/qdeclarativegeomapparameter_p.h
index 8fa5bfd1..23d028cd 100644
--- a/src/location/declarativemaps/qdeclarativegeomapparameter_p.h
+++ b/src/location/declarativemaps/qdeclarativegeomapparameter_p.h
@@ -61,6 +61,8 @@ QT_BEGIN_NAMESPACE
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoMapParameter : public QGeoMapParameter, public QQmlParserStatus
{
Q_OBJECT
+ QML_NAMED_ELEMENT(DynamicMapParameter)
+ QML_ADDED_IN_VERSION(5, 0)
Q_INTERFACES(QQmlParserStatus)
// this type must not declare any additional properties
diff --git a/src/location/declarativemaps/qdeclarativegeoroute_p.h b/src/location/declarativemaps/qdeclarativegeoroute_p.h
index 648883f3..414d8a03 100644
--- a/src/location/declarativemaps/qdeclarativegeoroute_p.h
+++ b/src/location/declarativemaps/qdeclarativegeoroute_p.h
@@ -67,15 +67,15 @@ class QDeclarativeGeoRouteQuery;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoRoute : public QObject
{
Q_OBJECT
-
+ QML_NAMED_ELEMENT(Route)
Q_PROPERTY(QGeoRectangle bounds READ bounds CONSTANT)
Q_PROPERTY(int travelTime READ travelTime CONSTANT)
Q_PROPERTY(qreal distance READ distance CONSTANT)
Q_PROPERTY(QList<QGeoCoordinate> path READ path WRITE setPath NOTIFY pathChanged)
Q_PROPERTY(QList<QGeoRouteSegment> segments READ segments CONSTANT)
- Q_PROPERTY(QDeclarativeGeoRouteQuery *routeQuery READ routeQuery REVISION 11)
- Q_PROPERTY(QList<QDeclarativeGeoRoute *> legs READ legs CONSTANT REVISION 12)
- Q_PROPERTY(QVariantMap extendedAttributes READ extendedAttributes CONSTANT REVISION 13)
+ Q_PROPERTY(QDeclarativeGeoRouteQuery *routeQuery READ routeQuery REVISION(5, 11))
+ Q_PROPERTY(QList<QDeclarativeGeoRoute *> legs READ legs CONSTANT REVISION(5, 12))
+ Q_PROPERTY(QVariantMap extendedAttributes READ extendedAttributes CONSTANT REVISION(5, 13))
Q_PROPERTY(int legIndex READ legIndex CONSTANT)
Q_PROPERTY(QDeclarativeGeoRoute *overallRoute READ overallRoute CONSTANT)
diff --git a/src/location/declarativemaps/qdeclarativegeoroutemodel_p.h b/src/location/declarativemaps/qdeclarativegeoroutemodel_p.h
index 628a1e05..9276ef2a 100644
--- a/src/location/declarativemaps/qdeclarativegeoroutemodel_p.h
+++ b/src/location/declarativemaps/qdeclarativegeoroutemodel_p.h
@@ -75,6 +75,8 @@ class QDeclarativeGeoRouteQuery;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoRouteModel : public QAbstractListModel, public QQmlParserStatus
{
Q_OBJECT
+ QML_NAMED_ELEMENT(RouteModel)
+ QML_ADDED_IN_VERSION(5, 0)
Q_ENUMS(Status)
Q_ENUMS(RouteError)
@@ -193,6 +195,8 @@ private:
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoWaypoint : public QGeoCoordinateObject, public QQmlParserStatus
{
Q_OBJECT
+ QML_NAMED_ELEMENT(Waypoint)
+ QML_ADDED_IN_VERSION(5, 11)
Q_PROPERTY(double latitude READ latitude WRITE setLatitude STORED false)
Q_PROPERTY(double longitude READ longitude WRITE setLongitude STORED false)
@@ -276,6 +280,8 @@ protected:
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoRouteQuery : public QObject, public QQmlParserStatus
{
Q_OBJECT
+ QML_NAMED_ELEMENT(RouteQuery)
+ QML_ADDED_IN_VERSION(5, 0)
Q_ENUMS(TravelMode)
Q_ENUMS(FeatureType)
Q_ENUMS(FeatureWeight)
@@ -295,8 +301,8 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoRouteQuery : public QObject, publ
Q_PROPERTY(QVariantList waypoints READ waypoints WRITE setWaypoints NOTIFY waypointsChanged)
Q_PROPERTY(QList<QGeoRectangle> excludedAreas READ excludedAreas WRITE setExcludedAreas NOTIFY excludedAreasChanged)
Q_PROPERTY(QList<int> featureTypes READ featureTypes NOTIFY featureTypesChanged)
- Q_PROPERTY(QVariantMap extraParameters READ extraParameters REVISION 11)
- Q_PROPERTY(QDateTime departureTime READ departureTime WRITE setDepartureTime NOTIFY departureTimeChanged REVISION 13)
+ Q_PROPERTY(QVariantMap extraParameters READ extraParameters REVISION(5, 11))
+ Q_PROPERTY(QDateTime departureTime READ departureTime WRITE setDepartureTime NOTIFY departureTimeChanged REVISION(5, 13))
Q_PROPERTY(QQmlListProperty<QObject> quickChildren READ declarativeChildren DESIGNABLE false)
Q_CLASSINFO("DefaultProperty", "quickChildren")
Q_INTERFACES(QQmlParserStatus)
diff --git a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h
index 28df81da..02aa56a7 100644
--- a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h
+++ b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h
@@ -67,9 +67,20 @@ QT_BEGIN_NAMESPACE
class QDeclarativeGeoServiceProviderRequirements;
+// From QtPositioning, needs to be registered in the Location module as well.
+// Can probably just be a QVariantMap?
+class QDeclarativePluginParameterForeign
+{
+ Q_GADGET
+ QML_FOREIGN(QDeclarativePluginParameter)
+ QML_NAMED_ELEMENT(PluginParameter)
+};
+
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoServiceProvider : public QObject, public QQmlParserStatus
{
Q_OBJECT
+ QML_NAMED_ELEMENT(Plugin)
+ QML_ADDED_IN_VERSION(5, 0)
Q_ENUMS(RoutingFeature)
Q_ENUMS(GeocodingFeature)
Q_ENUMS(MappingFeature)
@@ -220,6 +231,9 @@ private:
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoServiceProviderRequirements : public QObject
{
Q_OBJECT
+ QML_NAMED_ELEMENT(PluginRequirements)
+ QML_UNCREATABLE("PluginRequirements is not intended instantiable by developer.")
+ QML_ADDED_IN_VERSION(5, 0)
Q_PROPERTY(QDeclarativeGeoServiceProvider::MappingFeatures mapping
READ mappingRequirements WRITE setMappingRequirements
NOTIFY mappingRequirementsChanged)
diff --git a/src/location/declarativeplaces/qdeclarativecategory_p.h b/src/location/declarativeplaces/qdeclarativecategory_p.h
index c4a0b4f3..01304b0c 100644
--- a/src/location/declarativeplaces/qdeclarativecategory_p.h
+++ b/src/location/declarativeplaces/qdeclarativecategory_p.h
@@ -69,6 +69,8 @@ class QPlaceManager;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeCategory : public QObject, public QQmlParserStatus
{
Q_OBJECT
+ QML_NAMED_ELEMENT(Category)
+ QML_ADDED_IN_VERSION(5, 0)
Q_ENUMS(Status Visibility)
diff --git a/src/location/declarativeplaces/qdeclarativecontactdetails_p.h b/src/location/declarativeplaces/qdeclarativecontactdetails_p.h
index 32c0fe43..a8fc5c97 100644
--- a/src/location/declarativeplaces/qdeclarativecontactdetails_p.h
+++ b/src/location/declarativeplaces/qdeclarativecontactdetails_p.h
@@ -60,6 +60,11 @@ QT_BEGIN_NAMESPACE
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeContactDetails : public QQmlPropertyMap
{
Q_OBJECT
+ QML_NAMED_ELEMENT(ContactDetails)
+ QML_ADDED_IN_VERSION(5, 0)
+ QML_UNCREATABLE("ContactDetails instances cannot be instantiated. "
+ "Only Place types have ContactDetails and they cannot "
+ "be re-assigned (but can be modified).")
public:
explicit QDeclarativeContactDetails(QObject *parent = nullptr);
diff --git a/src/location/declarativeplaces/qdeclarativeplace_p.h b/src/location/declarativeplaces/qdeclarativeplace_p.h
index e4d94017..5b1f8274 100644
--- a/src/location/declarativeplaces/qdeclarativeplace_p.h
+++ b/src/location/declarativeplaces/qdeclarativeplace_p.h
@@ -74,7 +74,8 @@ class QDeclarativeContactDetails;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativePlace : public QObject, public QQmlParserStatus
{
Q_OBJECT
-
+ QML_NAMED_ELEMENT(Place)
+ QML_ADDED_IN_VERSION(5, 0)
Q_ENUMS(Status Visibility)
Q_PROPERTY(QPlace place READ place WRITE setPlace)
diff --git a/src/location/declarativeplaces/qdeclarativeplacecontentmodel_p.h b/src/location/declarativeplaces/qdeclarativeplacecontentmodel_p.h
index c5b09eaa..21cb4c32 100644
--- a/src/location/declarativeplaces/qdeclarativeplacecontentmodel_p.h
+++ b/src/location/declarativeplaces/qdeclarativeplacecontentmodel_p.h
@@ -150,6 +150,10 @@ private:
class QDeclarativePlaceReviewModel : public QDeclarativePlaceContentModel
{
+ Q_GADGET
+ QML_NAMED_ELEMENT(ReviewModel)
+ QML_ADDED_IN_VERSION(5, 0)
+
public:
explicit QDeclarativePlaceReviewModel(QObject *parent = nullptr)
: QDeclarativePlaceContentModel(QPlaceContent::ReviewType, parent)
@@ -158,6 +162,9 @@ public:
class QDeclarativePlaceEditorialModel : public QDeclarativePlaceContentModel
{
+ Q_GADGET
+ QML_NAMED_ELEMENT(EditorialModel)
+ QML_ADDED_IN_VERSION(5, 0)
public:
explicit QDeclarativePlaceEditorialModel(QObject *parent = nullptr)
: QDeclarativePlaceContentModel(QPlaceContent::EditorialType, parent)
@@ -166,6 +173,9 @@ public:
class QDeclarativePlaceImageModel : public QDeclarativePlaceContentModel
{
+ Q_GADGET
+ QML_NAMED_ELEMENT(ImageModel)
+ QML_ADDED_IN_VERSION(5, 0)
public:
explicit QDeclarativePlaceImageModel(QObject *parent = nullptr)
: QDeclarativePlaceContentModel(QPlaceContent::ImageType, parent)
diff --git a/src/location/declarativeplaces/qdeclarativesearchresultmodel_p.h b/src/location/declarativeplaces/qdeclarativesearchresultmodel_p.h
index 8d6d2570..46f9531b 100644
--- a/src/location/declarativeplaces/qdeclarativesearchresultmodel_p.h
+++ b/src/location/declarativeplaces/qdeclarativesearchresultmodel_p.h
@@ -64,6 +64,8 @@ class QDeclarativeGeoServiceProvider;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeSearchResultModel : public QDeclarativeSearchModelBase
{
Q_OBJECT
+ QML_NAMED_ELEMENT(PlaceSearchModel)
+ QML_ADDED_IN_VERSION(5, 0)
Q_PROPERTY(QString searchTerm READ searchTerm WRITE setSearchTerm NOTIFY searchTermChanged)
Q_PROPERTY(QQmlListProperty<QDeclarativeCategory> categories READ categories NOTIFY categoriesChanged)
@@ -75,7 +77,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeSearchResultModel : public QDeclarat
Q_PROPERTY(QDeclarativeGeoServiceProvider *favoritesPlugin READ favoritesPlugin WRITE setFavoritesPlugin NOTIFY favoritesPluginChanged)
Q_PROPERTY(QVariantMap favoritesMatchParameters READ favoritesMatchParameters WRITE setFavoritesMatchParameters NOTIFY favoritesMatchParametersChanged)
- Q_PROPERTY(bool incremental MEMBER m_incremental NOTIFY incrementalChanged REVISION 12)
+ Q_PROPERTY(bool incremental MEMBER m_incremental NOTIFY incrementalChanged REVISION(5, 12))
Q_ENUMS(SearchResultType RelevanceHint)
diff --git a/src/location/declarativeplaces/qdeclarativesearchsuggestionmodel_p.h b/src/location/declarativeplaces/qdeclarativesearchsuggestionmodel_p.h
index cb8c1da4..f13da3df 100644
--- a/src/location/declarativeplaces/qdeclarativesearchsuggestionmodel_p.h
+++ b/src/location/declarativeplaces/qdeclarativesearchsuggestionmodel_p.h
@@ -64,6 +64,8 @@ class QGeoServiceProvider;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeSearchSuggestionModel : public QDeclarativeSearchModelBase
{
Q_OBJECT
+ QML_NAMED_ELEMENT(PlaceSearchSuggestionModel)
+ QML_ADDED_IN_VERSION(5, 0)
Q_PROPERTY(QString searchTerm READ searchTerm WRITE setSearchTerm NOTIFY searchTermChanged)
Q_PROPERTY(QStringList suggestions READ suggestions NOTIFY suggestionsChanged)
diff --git a/src/location/declarativeplaces/qdeclarativesupportedcategoriesmodel_p.h b/src/location/declarativeplaces/qdeclarativesupportedcategoriesmodel_p.h
index 225f6241..58c6529e 100644
--- a/src/location/declarativeplaces/qdeclarativesupportedcategoriesmodel_p.h
+++ b/src/location/declarativeplaces/qdeclarativesupportedcategoriesmodel_p.h
@@ -74,6 +74,8 @@ class QPlaceReply;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeSupportedCategoriesModel : public QAbstractItemModel, public QQmlParserStatus
{
Q_OBJECT
+ QML_NAMED_ELEMENT(CategoryModel)
+ QML_ADDED_IN_VERSION(5, 0)
Q_ENUMS(Status)
diff --git a/src/location/maps/qgeomaneuver.h b/src/location/maps/qgeomaneuver.h
index 1308bade..97d3c86b 100644
--- a/src/location/maps/qgeomaneuver.h
+++ b/src/location/maps/qgeomaneuver.h
@@ -43,6 +43,7 @@
#include <QtCore/QObject>
#include <QtCore/qshareddata.h>
#include <QtLocation/qlocationglobal.h>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -54,6 +55,7 @@ QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoManeuverPrivate, Q_LOCATION_
class Q_LOCATION_EXPORT QGeoManeuver
{
Q_GADGET
+ QML_VALUE_TYPE(routeManeuver)
Q_ENUMS(InstructionDirection)
Q_PROPERTY(bool valid READ isValid CONSTANT)
@@ -127,6 +129,13 @@ private:
Q_DECLARE_SHARED(QGeoManeuver)
+namespace QGeoManeuverForeignNamespace
+{
+ Q_NAMESPACE
+ QML_FOREIGN_NAMESPACE(QGeoManeuver)
+ QML_NAMED_ELEMENT(RouteManeuver)
+}
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QGeoManeuver)
diff --git a/src/location/maps/qgeomaptype_p.h b/src/location/maps/qgeomaptype_p.h
index 741e7865..4d1f12db 100644
--- a/src/location/maps/qgeomaptype_p.h
+++ b/src/location/maps/qgeomaptype_p.h
@@ -54,8 +54,9 @@
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QSharedDataPointer>
+#include <QtCore/QVariantMap>
#include <QtLocation/private/qlocationglobal_p.h>
-#include <QVariantMap>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -66,6 +67,7 @@ QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoMapTypePrivate, Q_LOCATION_P
class Q_LOCATION_PRIVATE_EXPORT QGeoMapType
{
Q_GADGET
+ QML_VALUE_TYPE(mapType)
Q_ENUMS(MapStyle)
Q_PROPERTY(MapStyle style READ style CONSTANT)
@@ -75,6 +77,8 @@ class Q_LOCATION_PRIVATE_EXPORT QGeoMapType
Q_PROPERTY(bool night READ night CONSTANT)
Q_PROPERTY(QGeoCameraCapabilities cameraCapabilities READ cameraCapabilities CONSTANT)
Q_PROPERTY(QVariantMap metadata READ metadata CONSTANT)
+
+ Q_MOC_INCLUDE(<QtLocation/private/qgeocameracapabilities_p.h>)
public:
enum MapStyle { // ### Qt6: change this to be a QFlags instead, or remove.
NoMap = 0,
@@ -126,6 +130,13 @@ private:
bool isEqual(const QGeoMapType &other) const noexcept;
};
+namespace QGeoMapTypeForeignNamespace
+{
+ Q_NAMESPACE
+ QML_FOREIGN_NAMESPACE(QGeoMapType)
+ QML_NAMED_ELEMENT(MapType)
+};
+
QT_END_NAMESPACE
#endif // QGEOMAPTYPE_H
diff --git a/src/location/maps/qgeoroute.h b/src/location/maps/qgeoroute.h
index 99eb699e..3450af25 100644
--- a/src/location/maps/qgeoroute.h
+++ b/src/location/maps/qgeoroute.h
@@ -46,6 +46,8 @@
#include <QtCore/QExplicitlySharedDataPointer>
#include <QtCore/QList>
+#include "QtQml/qqml.h"
+
QT_BEGIN_NAMESPACE
class QGeoCoordinate;
@@ -57,6 +59,7 @@ QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoRoutePrivate, Q_LOCATION_EX
class Q_LOCATION_EXPORT QGeoRoute
{
Q_GADGET
+ QML_NAMED_ELEMENT(route)
Q_PROPERTY(QGeoRectangle bounds READ bounds CONSTANT)
Q_PROPERTY(int travelTime READ travelTime CONSTANT)
diff --git a/src/location/maps/qgeoroute_p.h b/src/location/maps/qgeoroute_p.h
index da17455a..6b70863a 100644
--- a/src/location/maps/qgeoroute_p.h
+++ b/src/location/maps/qgeoroute_p.h
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
class QGeoCoordinate;
-class QGeoRoutePrivate : public QSharedData
+class Q_LOCATION_PRIVATE_EXPORT QGeoRoutePrivate : public QSharedData
{
public:
bool operator==(const QGeoRoutePrivate &other) const;
diff --git a/src/location/maps/qgeoroutesegment.h b/src/location/maps/qgeoroutesegment.h
index c32f8e92..7ab8a771 100644
--- a/src/location/maps/qgeoroutesegment.h
+++ b/src/location/maps/qgeoroutesegment.h
@@ -44,6 +44,7 @@
#include <QtCore/QExplicitlySharedDataPointer>
#include <QtCore/QList>
#include <QtLocation/qlocationglobal.h>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -55,6 +56,7 @@ QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoRouteSegmentPrivate, Q_LOCA
class Q_LOCATION_EXPORT QGeoRouteSegment
{
Q_GADGET
+ QML_VALUE_TYPE(routeSegment)
Q_PROPERTY(int travelTime READ travelTime CONSTANT)
Q_PROPERTY(qreal distance READ distance CONSTANT)
diff --git a/src/location/places/qplaceattribute.h b/src/location/places/qplaceattribute.h
index 9e865817..5e628f26 100644
--- a/src/location/places/qplaceattribute.h
+++ b/src/location/places/qplaceattribute.h
@@ -45,6 +45,7 @@
#include <QtCore/QSharedDataPointer>
#include <QtLocation/qlocationglobal.h>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -54,6 +55,7 @@ QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceAttributePrivate, Q_LOCATI
class Q_LOCATION_EXPORT QPlaceAttribute
{
Q_GADGET
+ QML_VALUE_TYPE(placeAttribute)
Q_PROPERTY(QString label READ label WRITE setLabel)
Q_PROPERTY(QString text READ text WRITE setText)
diff --git a/src/location/places/qplacecontactdetail.h b/src/location/places/qplacecontactdetail.h
index 3fed6a1e..5801a1f0 100644
--- a/src/location/places/qplacecontactdetail.h
+++ b/src/location/places/qplacecontactdetail.h
@@ -45,6 +45,7 @@
#include <QtCore/QSharedDataPointer>
#include <QtLocation/qlocationglobal.h>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -54,6 +55,7 @@ QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceContactDetailPrivate, Q_LO
class Q_LOCATION_EXPORT QPlaceContactDetail
{
Q_GADGET
+ QML_VALUE_TYPE(contactDetail)
Q_PROPERTY(QString label READ label WRITE setLabel)
Q_PROPERTY(QString value READ value WRITE setValue)
diff --git a/src/location/places/qplaceicon.h b/src/location/places/qplaceicon.h
index 6ae4d636..2360553c 100644
--- a/src/location/places/qplaceicon.h
+++ b/src/location/places/qplaceicon.h
@@ -45,6 +45,7 @@
#include <QtCore/QMetaType>
#include <QtCore/QSize>
#include <QtCore/QSharedDataPointer>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -57,6 +58,7 @@ QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceIconPrivate, Q_LOCATION_EX
class Q_LOCATION_EXPORT QPlaceIcon
{
Q_GADGET
+ QML_VALUE_TYPE(icon)
Q_PROPERTY(QVariantMap parameters READ parameters WRITE setParameters)
Q_PROPERTY(QPlaceManager *manager READ manager WRITE setManager)
diff --git a/src/location/places/qplaceratings.h b/src/location/places/qplaceratings.h
index 019c20b1..6a73fb9a 100644
--- a/src/location/places/qplaceratings.h
+++ b/src/location/places/qplaceratings.h
@@ -43,6 +43,7 @@
#include <QtCore/QMetaType>
#include <QtCore/QSharedDataPointer>
#include <QtLocation/qlocationglobal.h>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -52,6 +53,7 @@ QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceRatingsPrivate, Q_LOCATION
class Q_LOCATION_EXPORT QPlaceRatings
{
Q_GADGET
+ QML_VALUE_TYPE(ratings)
Q_PROPERTY(qreal average READ average WRITE setAverage)
Q_PROPERTY(qreal maximum READ maximum WRITE setMaximum)
Q_PROPERTY(int count READ count WRITE setCount)
diff --git a/src/location/places/qplacesupplier.h b/src/location/places/qplacesupplier.h
index cf4421b2..81a4aff5 100644
--- a/src/location/places/qplacesupplier.h
+++ b/src/location/places/qplacesupplier.h
@@ -43,6 +43,7 @@
#include <QtLocation/qlocationglobal.h>
#include <QtCore/QMetaType>
#include <QtCore/QSharedDataPointer>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -54,6 +55,7 @@ QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceSupplierPrivate, Q_LOCATIO
class Q_LOCATION_EXPORT QPlaceSupplier
{
Q_GADGET
+ QML_VALUE_TYPE(supplier)
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(QString supplierId READ supplierId WRITE setSupplierId)
Q_PROPERTY(QUrl url READ url WRITE setUrl)
diff --git a/src/location/places/qplaceuser.h b/src/location/places/qplaceuser.h
index b4c2f915..6dcca89b 100644
--- a/src/location/places/qplaceuser.h
+++ b/src/location/places/qplaceuser.h
@@ -43,6 +43,7 @@
#include <QtCore/QMetaType>
#include <QtCore/QSharedDataPointer>
#include <QtLocation/qlocationglobal.h>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -52,6 +53,7 @@ QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QPlaceUserPrivate, Q_LOCATION_EX
class Q_LOCATION_EXPORT QPlaceUser
{
Q_GADGET
+ QML_VALUE_TYPE(user)
Q_PROPERTY(QString userId READ userId WRITE setUserId)
Q_PROPERTY(QString name READ name WRITE setName)
diff --git a/src/location/qlocation_quick.cpp b/src/location/qlocation_quick.cpp
new file mode 100644
index 00000000..0ad82693
--- /dev/null
+++ b/src/location/qlocation_quick.cpp
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 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 <QtLocation/qplaceratings.h>
+#include <QtLocation/qplaceicon.h>
+#include <QtLocation/qplacesupplier.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace {
+
+bool convertToGadget(const QMetaObject &metaObject, const QVariantMap &map, void *gadget)
+{
+ for (auto &&[key, value] : map.asKeyValueRange()) {
+ const int propIndex = metaObject.indexOfProperty(key.toUtf8());
+ if (propIndex == -1) {
+ qCritical("No property %s in %s", qPrintable(key), metaObject.className());
+ return false;
+ }
+ const QMetaProperty prop = metaObject.property(propIndex);
+ bool successfulWrite = false;
+ if (value.metaType() != prop.metaType()) {
+ QVariant coercedValue = value;
+ if (!coercedValue.convert(prop.metaType())) {
+ qCritical("Could not convert value from %s to %s for property %s::%s",
+ value.typeName(), prop.typeName(), metaObject.className(), qPrintable(key));
+ return false;
+ }
+ successfulWrite = prop.writeOnGadget(gadget, coercedValue);
+ } else {
+ successfulWrite = prop.writeOnGadget(gadget, value);
+ }
+ if (!successfulWrite) {
+ qCritical("Could not set property %s on %s", qPrintable(key), metaObject.className());
+ return false;
+ }
+ }
+ return true;
+}
+
+template<typename SourceType, typename GadgetType>
+bool converterToGadget(const void *src, void *gadget)
+{
+ const QMetaObject &metaObject = GadgetType::staticMetaObject;
+ QVariantMap variantMap;
+ if constexpr (std::is_same_v<SourceType, QJSValue>) {
+ const QJSValue &jsValue = *static_cast<const QJSValue *>(src);
+ const QVariant &variant = jsValue.toVariant();
+ if (variant.metaType() != QMetaType::fromType<QVariantMap>())
+ return false;
+ variantMap = variant.toMap();
+ } else {
+ static_assert(std::is_same_v<SourceType, QVariantMap>);
+ variantMap = *static_cast<const QVariantMap *>(src);
+ }
+ return convertToGadget(metaObject, variantMap, gadget);
+}
+
+template<typename GadgetType>
+bool registerConverterToGadget()
+{
+ if (!QMetaType::registerConverterFunction(converterToGadget<QJSValue, GadgetType>,
+ QMetaType::fromType<QJSValue>(), QMetaType::fromType<GadgetType>())) {
+ qCritical("Failed to register conversion function from QJSValue to %s",
+ GadgetType::staticMetaObject.className());
+ return false;
+ }
+ if (!QMetaType::registerConverterFunction(converterToGadget<QVariantMap, GadgetType>,
+ QMetaType::fromType<QVariantMap>(), QMetaType::fromType<GadgetType>())) {
+ qCritical("Failed to register conversion function from QVariantMap to %s",
+ GadgetType::staticMetaObject.className());
+ return false;
+ }
+
+ return true;
+}
+
+} // anonymous namespace
+
+void registerConverters()
+{
+ registerConverterToGadget<QPlaceRatings>();
+ registerConverterToGadget<QPlaceIcon>();
+ registerConverterToGadget<QPlaceSupplier>();
+}
+
+Q_CONSTRUCTOR_FUNCTION(registerConverters);
+
+
+
+QT_END_NAMESPACE
diff --git a/src/location/quickmapitems/qdeclarativecirclemapitem_p.h b/src/location/quickmapitems/qdeclarativecirclemapitem_p.h
index fbbe39a7..9e5f4e1a 100644
--- a/src/location/quickmapitems/qdeclarativecirclemapitem_p.h
+++ b/src/location/quickmapitems/qdeclarativecirclemapitem_p.h
@@ -64,13 +64,15 @@ class QDeclarativeCircleMapItemPrivate;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeCircleMapItem : public QDeclarativeGeoMapItemBase
{
Q_OBJECT
+ QML_NAMED_ELEMENT(MapCircle)
+ QML_ADDED_IN_VERSION(5, 0)
Q_ENUMS(Backend)
Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter NOTIFY centerChanged)
Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
Q_PROPERTY(QDeclarativeMapLineProperties *border READ border CONSTANT)
- Q_PROPERTY(Backend backend READ backend WRITE setBackend NOTIFY backendChanged REVISION 15)
+ Q_PROPERTY(Backend backend READ backend WRITE setBackend NOTIFY backendChanged REVISION(5, 15))
public:
enum Backend {
diff --git a/src/location/quickmapitems/qdeclarativegeomap_p.h b/src/location/quickmapitems/qdeclarativegeomap_p.h
index 3d4fc511..7875b3fd 100644
--- a/src/location/quickmapitems/qdeclarativegeomap_p.h
+++ b/src/location/quickmapitems/qdeclarativegeomap_p.h
@@ -78,6 +78,8 @@ class QDeclarativeGeoMapParameter;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoMap : public QQuickItem
{
Q_OBJECT
+ QML_NAMED_ELEMENT(Map)
+ QML_ADDED_IN_VERSION(5, 0)
Q_ENUMS(QGeoServiceProvider::Error)
Q_PROPERTY(QQuickGeoMapGestureArea *gesture READ gesture CONSTANT)
Q_PROPERTY(QDeclarativeGeoServiceProvider *plugin READ plugin WRITE setPlugin NOTIFY pluginChanged)
@@ -106,7 +108,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoMap : public QQuickItem
Q_PROPERTY(bool copyrightsVisible READ copyrightsVisible WRITE setCopyrightsVisible NOTIFY copyrightsVisibleChanged)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
Q_PROPERTY(bool mapReady READ mapReady NOTIFY mapReadyChanged)
- Q_PROPERTY(QRectF visibleArea READ visibleArea WRITE setVisibleArea NOTIFY visibleAreaChanged REVISION 12)
+ Q_PROPERTY(QRectF visibleArea READ visibleArea WRITE setVisibleArea NOTIFY visibleAreaChanged REVISION(5, 12))
Q_INTERFACES(QQmlParserStatus)
public:
diff --git a/src/location/quickmapitems/qdeclarativegeomapcopyrightsnotice_p.h b/src/location/quickmapitems/qdeclarativegeomapcopyrightsnotice_p.h
index 7e4c9957..9b1634e3 100644
--- a/src/location/quickmapitems/qdeclarativegeomapcopyrightsnotice_p.h
+++ b/src/location/quickmapitems/qdeclarativegeomapcopyrightsnotice_p.h
@@ -69,6 +69,9 @@ class QDeclarativeGeoMapCopyrightNoticePrivate;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoMapCopyrightNotice : public QQuickPaintedItem
{
Q_OBJECT
+ QML_NAMED_ELEMENT(MapCopyrightNotice)
+ QML_ADDED_IN_VERSION(5, 0)
+
Q_PROPERTY(QDeclarativeGeoMap *mapSource READ mapSource WRITE setMapSource NOTIFY mapSourceChanged)
Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet NOTIFY styleSheetChanged)
diff --git a/src/location/quickmapitems/qdeclarativegeomapitembase.cpp b/src/location/quickmapitems/qdeclarativegeomapitembase.cpp
index 3767351c..1d75cec4 100644
--- a/src/location/quickmapitems/qdeclarativegeomapitembase.cpp
+++ b/src/location/quickmapitems/qdeclarativegeomapitembase.cpp
@@ -294,11 +294,6 @@ QSGNode *QDeclarativeGeoMapItemBase::updateMapItemPaintNode(QSGNode *oldNode, Up
return nullptr;
}
-QGeoMap::ItemType QDeclarativeGeoMapItemBase::itemType() const
-{
- return m_itemType;
-}
-
/*!
\internal
diff --git a/src/location/quickmapitems/qdeclarativegeomapitembase_p.h b/src/location/quickmapitems/qdeclarativegeomapitembase_p.h
index 8031a204..315a8c89 100644
--- a/src/location/quickmapitems/qdeclarativegeomapitembase_p.h
+++ b/src/location/quickmapitems/qdeclarativegeomapitembase_p.h
@@ -80,10 +80,13 @@ struct Q_LOCATION_PRIVATE_EXPORT QGeoMapViewportChangeEvent
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoMapItemBase : public QQuickItem
{
Q_OBJECT
+ QML_NAMED_ELEMENT(GeoMapItemBase)
+ QML_ADDED_IN_VERSION(5, 0)
+ QML_UNCREATABLE("GeoMapItemBase is not intended instantiable by developer.")
Q_PROPERTY(QGeoShape geoShape READ geoShape WRITE setGeoShape STORED false )
- Q_PROPERTY(bool autoFadeIn READ autoFadeIn WRITE setAutoFadeIn REVISION 14)
- Q_PROPERTY(int lodThreshold READ lodThreshold WRITE setLodThreshold NOTIFY lodThresholdChanged REVISION 15)
+ Q_PROPERTY(bool autoFadeIn READ autoFadeIn WRITE setAutoFadeIn REVISION(5, 14))
+ Q_PROPERTY(int lodThreshold READ lodThreshold WRITE setLodThreshold NOTIFY lodThresholdChanged REVISION(5, 15))
public:
explicit QDeclarativeGeoMapItemBase(QQuickItem *parent = nullptr);
@@ -107,13 +110,12 @@ public:
QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
virtual QSGNode *updateMapItemPaintNode(QSGNode *, UpdatePaintNodeData *);
- QGeoMap::ItemType itemType() const;
+ inline QGeoMap::ItemType itemType() const { return m_itemType; }
qreal mapItemOpacity() const;
void setParentGroup(QDeclarativeGeoMapItemGroup &parentGroup);
template <typename T = QObject>
-
QList<T*> quickChildren() const
{
QList<T*> res;
diff --git a/src/location/quickmapitems/qdeclarativegeomapitemgroup_p.h b/src/location/quickmapitems/qdeclarativegeomapitemgroup_p.h
index c3e997ad..3883b247 100644
--- a/src/location/quickmapitems/qdeclarativegeomapitemgroup_p.h
+++ b/src/location/quickmapitems/qdeclarativegeomapitemgroup_p.h
@@ -61,6 +61,9 @@ class QDeclarativeGeoMap;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoMapItemGroup : public QQuickItem
{
Q_OBJECT
+ QML_NAMED_ELEMENT(MapItemGroup)
+ QML_ADDED_IN_VERSION(5, 0)
+
public:
explicit QDeclarativeGeoMapItemGroup(QQuickItem *parent = nullptr);
virtual ~QDeclarativeGeoMapItemGroup();
diff --git a/src/location/quickmapitems/qdeclarativegeomapitemview_p.h b/src/location/quickmapitems/qdeclarativegeomapitemview_p.h
index 25c54d48..925df000 100644
--- a/src/location/quickmapitems/qdeclarativegeomapitemview_p.h
+++ b/src/location/quickmapitems/qdeclarativegeomapitemview_p.h
@@ -80,14 +80,15 @@ class QDeclarativeGeoMapItemGroup;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoMapItemView : public QDeclarativeGeoMapItemGroup
{
Q_OBJECT
-
+ QML_NAMED_ELEMENT(MapItemView)
+ QML_ADDED_IN_VERSION(5, 0)
Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
Q_PROPERTY(bool autoFitViewport READ autoFitViewport WRITE setAutoFitViewport NOTIFY autoFitViewportChanged)
- Q_PROPERTY(QQuickTransition *add MEMBER m_enter REVISION 12)
- Q_PROPERTY(QQuickTransition *remove MEMBER m_exit REVISION 12)
- Q_PROPERTY(QList<QQuickItem *> mapItems READ mapItems REVISION 12)
- Q_PROPERTY(bool incubateDelegates READ incubateDelegates WRITE setIncubateDelegates NOTIFY incubateDelegatesChanged REVISION 12)
+ Q_PROPERTY(QQuickTransition *add MEMBER m_enter REVISION(5, 12))
+ Q_PROPERTY(QQuickTransition *remove MEMBER m_exit REVISION(5, 12))
+ Q_PROPERTY(QList<QQuickItem *> mapItems READ mapItems REVISION(5, 12))
+ Q_PROPERTY(bool incubateDelegates READ incubateDelegates WRITE setIncubateDelegates NOTIFY incubateDelegatesChanged REVISION(5, 12))
public:
explicit QDeclarativeGeoMapItemView(QQuickItem *parent = nullptr);
diff --git a/src/location/quickmapitems/qdeclarativegeomapquickitem_p.h b/src/location/quickmapitems/qdeclarativegeomapquickitem_p.h
index b8e093af..e0d32d7d 100644
--- a/src/location/quickmapitems/qdeclarativegeomapquickitem_p.h
+++ b/src/location/quickmapitems/qdeclarativegeomapquickitem_p.h
@@ -76,6 +76,8 @@ public:
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoMapQuickItem : public QDeclarativeGeoMapItemBase
{
Q_OBJECT
+ QML_NAMED_ELEMENT(MapQuickItem)
+ QML_ADDED_IN_VERSION(5, 0)
Q_PROPERTY(QGeoCoordinate coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged)
Q_PROPERTY(QPointF anchorPoint READ anchorPoint WRITE setAnchorPoint NOTIFY anchorPointChanged)
Q_PROPERTY(qreal zoomLevel READ zoomLevel WRITE setZoomLevel NOTIFY zoomLevelChanged)
diff --git a/src/location/quickmapitems/qdeclarativepolygonmapitem_p.h b/src/location/quickmapitems/qdeclarativepolygonmapitem_p.h
index d388c007..fae9c626 100644
--- a/src/location/quickmapitems/qdeclarativepolygonmapitem_p.h
+++ b/src/location/quickmapitems/qdeclarativepolygonmapitem_p.h
@@ -62,12 +62,14 @@ class QDeclarativePolygonMapItemPrivate;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativePolygonMapItem : public QDeclarativeGeoMapItemBase
{
Q_OBJECT
+ QML_NAMED_ELEMENT(MapPolygon)
+ QML_ADDED_IN_VERSION(5, 0)
Q_ENUMS(Backend)
Q_PROPERTY(QList<QGeoCoordinate> path READ path WRITE setPath NOTIFY pathChanged)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
Q_PROPERTY(QDeclarativeMapLineProperties *border READ border CONSTANT)
- Q_PROPERTY(Backend backend READ backend WRITE setBackend NOTIFY backendChanged REVISION 15)
+ Q_PROPERTY(Backend backend READ backend WRITE setBackend NOTIFY backendChanged REVISION(5, 15))
public:
enum Backend {
diff --git a/src/location/quickmapitems/qdeclarativepolylinemapitem_p.h b/src/location/quickmapitems/qdeclarativepolylinemapitem_p.h
index bd7cc9a2..e5446d7b 100644
--- a/src/location/quickmapitems/qdeclarativepolylinemapitem_p.h
+++ b/src/location/quickmapitems/qdeclarativepolylinemapitem_p.h
@@ -66,6 +66,8 @@ QT_BEGIN_NAMESPACE
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeMapLineProperties : public QObject
{
Q_OBJECT
+ QML_ELEMENT
+ QML_ANONYMOUS
Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
@@ -92,11 +94,13 @@ class QDeclarativePolylineMapItemPrivate;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativePolylineMapItem : public QDeclarativeGeoMapItemBase
{
Q_OBJECT
+ QML_NAMED_ELEMENT(MapPolyline)
+ QML_ADDED_IN_VERSION(5, 0)
Q_ENUMS(Backend)
Q_PROPERTY(QList<QGeoCoordinate> path READ path WRITE setPath NOTIFY pathChanged)
Q_PROPERTY(QDeclarativeMapLineProperties *line READ line CONSTANT)
- Q_PROPERTY(Backend backend READ backend WRITE setBackend NOTIFY backendChanged REVISION 15)
+ Q_PROPERTY(Backend backend READ backend WRITE setBackend NOTIFY backendChanged REVISION(5, 15))
public:
enum Backend {
diff --git a/src/location/quickmapitems/qdeclarativerectanglemapitem_p.h b/src/location/quickmapitems/qdeclarativerectanglemapitem_p.h
index 968b9f21..066ba241 100644
--- a/src/location/quickmapitems/qdeclarativerectanglemapitem_p.h
+++ b/src/location/quickmapitems/qdeclarativerectanglemapitem_p.h
@@ -67,13 +67,15 @@ class QDeclarativeRectangleMapItemPrivate;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeRectangleMapItem: public QDeclarativeGeoMapItemBase
{
Q_OBJECT
+ QML_NAMED_ELEMENT(MapRectangle)
+ QML_ADDED_IN_VERSION(5, 0)
Q_ENUMS(Backend)
Q_PROPERTY(QGeoCoordinate topLeft READ topLeft WRITE setTopLeft NOTIFY topLeftChanged)
Q_PROPERTY(QGeoCoordinate bottomRight READ bottomRight WRITE setBottomRight NOTIFY bottomRightChanged)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
Q_PROPERTY(QDeclarativeMapLineProperties *border READ border CONSTANT)
- Q_PROPERTY(Backend backend READ backend WRITE setBackend NOTIFY backendChanged REVISION 15)
+ Q_PROPERTY(Backend backend READ backend WRITE setBackend NOTIFY backendChanged REVISION(5, 15))
public:
enum Backend {
diff --git a/src/location/quickmapitems/qdeclarativeroutemapitem_p.h b/src/location/quickmapitems/qdeclarativeroutemapitem_p.h
index 94cc844a..df9e982f 100644
--- a/src/location/quickmapitems/qdeclarativeroutemapitem_p.h
+++ b/src/location/quickmapitems/qdeclarativeroutemapitem_p.h
@@ -67,6 +67,8 @@ class QDeclarativeGeoRoute;
class Q_LOCATION_PRIVATE_EXPORT QDeclarativeRouteMapItem : public QDeclarativePolylineMapItem
{
Q_OBJECT
+ QML_NAMED_ELEMENT(MapRoute)
+ QML_ADDED_IN_VERSION(5, 0)
Q_PROPERTY(QDeclarativeGeoRoute *route READ route WRITE setRoute NOTIFY routeChanged)
diff --git a/src/location/quickmapitems/qquickgeomapgesturearea_p.h b/src/location/quickmapitems/qquickgeomapgesturearea_p.h
index e8735761..86bd3537 100644
--- a/src/location/quickmapitems/qquickgeomapgesturearea_p.h
+++ b/src/location/quickmapitems/qquickgeomapgesturearea_p.h
@@ -73,6 +73,9 @@ class QGeoMap;
class Q_LOCATION_PRIVATE_EXPORT QGeoMapPinchEvent : public QObject
{
Q_OBJECT
+ QML_NAMED_ELEMENT(MapPinchEvent)
+ QML_UNCREATABLE("(Map)PinchEvent is not intended instantiable by developer.")
+ QML_ADDED_IN_VERSION(5, 0)
Q_PROPERTY(QPointF center READ center)
Q_PROPERTY(qreal angle READ angle)
@@ -116,6 +119,9 @@ private:
class Q_LOCATION_PRIVATE_EXPORT QQuickGeoMapGestureArea: public QQuickItem
{
Q_OBJECT
+ QML_NAMED_ELEMENT(MapGestureArea)
+ QML_UNCREATABLE("(Map)GestureArea is not intended instantiable by developer.")
+ QML_ADDED_IN_VERSION(5, 0)
Q_ENUMS(GeoMapGesture)
Q_FLAGS(AcceptedGestures)
@@ -127,7 +133,7 @@ class Q_LOCATION_PRIVATE_EXPORT QQuickGeoMapGestureArea: public QQuickItem
Q_PROPERTY(AcceptedGestures acceptedGestures READ acceptedGestures WRITE setAcceptedGestures NOTIFY acceptedGesturesChanged)
Q_PROPERTY(qreal maximumZoomLevelChange READ maximumZoomLevelChange WRITE setMaximumZoomLevelChange NOTIFY maximumZoomLevelChangeChanged)
Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged)
- Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged REVISION 1)
+ Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged REVISION(5, 1))
public:
QQuickGeoMapGestureArea(QDeclarativeGeoMap *map);
diff --git a/tests/auto/declarative_location_core/tst_routing.qml b/tests/auto/declarative_location_core/tst_routing.qml
index 6fc92f8a..7d442d96 100644
--- a/tests/auto/declarative_location_core/tst_routing.qml
+++ b/tests/auto/declarative_location_core/tst_routing.qml
@@ -573,7 +573,7 @@ Item {
coordinate: QtPositioning.coordinate(71, 71)
bearing: 43
- MapParameter {
+ DynamicMapParameter {
id: param1
type: "user_distance"
property real distance: 10
@@ -854,7 +854,7 @@ Item {
compare(model.get(0).path[0].latitude, fcoordinate1.latitude + 1) // new value should be echoed
// Extra parameter
- var param = Qt.createQmlObject ('import QtLocation 5.9; MapParameter { type : "test-traveltime"; property var requestedTime : 42}', root)
+ var param = Qt.createQmlObject ('import QtLocation 5.9; DynamicMapParameter { type : "test-traveltime"; property var requestedTime : 42}', root)
var initialParams = cloneArray(filledRouteQuery.quickChildren)
var modifiedParams = cloneArray(initialParams)
modifiedParams.push(param)
@@ -877,7 +877,7 @@ Item {
compare(model.get(0).travelTime, 123456)
else
compare(model.get(0).travelTime, 0)
- var secondParam = Qt.createQmlObject ('import QtLocation 5.9; MapParameter { type : "foo"; property var bar : 42}', root)
+ var secondParam = Qt.createQmlObject ('import QtLocation 5.9; DynamicMapParameter { type : "foo"; property var bar : 42}', root)
modifiedParams.push(secondParam)
param.requestedTime = 44
filledRouteQuery.quickChildren = modifiedParams
diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml
index 4fc910ed..290b8f25 100644
--- a/tests/auto/declarative_ui/tst_map.qml
+++ b/tests/auto/declarative_ui/tst_map.qml
@@ -131,7 +131,7 @@ Item {
height: 200
}
- MapParameter {
+ DynamicMapParameter {
id: testParameter
type: "cameraCenter_test"
property var center: QtPositioning.coordinate(-33.0, -47.0)