From 450793356b6f62b70a896b85011070760c5d1d56 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Mon, 24 Feb 2014 09:22:38 +0100 Subject: Fix QtLocation QML API and its version. Despite missing QtLocation 5.3 release we will fix the QML Location API as of 5.3 release time. This does not affect the C++ API. We keep the 5.0 version tag but 5.3 becomes the defacto standard. Change-Id: I93838a97a01c8b886a86e8b2bab3dedc595a2ee6 Reviewed-by: Aaron McCarthy --- src/imports/location/location.cpp | 100 +++++++++++++++++++--------------- src/imports/location/plugins.qmltypes | 81 ++++++++++----------------- 2 files changed, 84 insertions(+), 97 deletions(-) diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp index 7308c4eb..8af789b8 100644 --- a/src/imports/location/location.cpp +++ b/src/imports/location/location.cpp @@ -91,64 +91,74 @@ class QLocationDeclarativeModule: public QQmlExtensionPlugin public: virtual void registerTypes(const char *uri) { - if (QLatin1String(uri) == QLatin1String("QtMobility.location")) { - qWarning("QtMobility.location is not supported. Use QtLocation instead."); - } else if (QLatin1String(uri) == QLatin1String("Qt.location")) { - qWarning("Qt.location is not supported. Use QtLocation instead."); - } else if (QLatin1String(uri) == QLatin1String("QtLocation")) { + if (QLatin1String(uri) == QLatin1String("QtLocation")) { - // @uri QtLocation 5.0 + // @uri QtLocation + int major = 5; + int minor = 0; - qmlRegisterType(uri, 5, 0, "Plugin"); - qmlRegisterType(uri, 5, 0, "PluginParameter"); - qmlRegisterUncreatableType(uri, 5, 0, "PluginRequirements", + // Register the 5.0 types + // 5.0 is siltent and not advertised + + qmlRegisterType(uri, major, minor, "Plugin"); + qmlRegisterType(uri, major, minor, "PluginParameter"); + qmlRegisterUncreatableType(uri, major, minor, "PluginRequirements", QStringLiteral("PluginRequirements is not intended instantiable by developer.")); - qmlRegisterType(uri, 5, 0, "Map"); + qmlRegisterType(uri, major, minor, "Map"); - qmlRegisterUncreatableType(uri, 5, 0, "GeoMapItemBase", + qmlRegisterUncreatableType(uri, major, minor, "GeoMapItemBase", QStringLiteral("HeoMapItemBase is not intended instantiable by developer.")); - qmlRegisterType(uri, 5, 0, "MapQuickItem"); - qmlRegisterType(uri, 5, 0, "MapItemView"); - - qmlRegisterType(uri, 5, 0, "GeocodeModel"); // geocoding and reverse geocoding - qmlRegisterType(uri, 5, 0, "RouteModel"); - qmlRegisterType(uri, 5, 0, "RouteQuery"); - qmlRegisterType(uri, 5, 0, "Route"); // data type - qmlRegisterType(uri, 5, 0, "RouteSegment"); - qmlRegisterType(uri, 5, 0, "RouteManeuver"); - qmlRegisterUncreatableType(uri, 5, 0, "MapPinchEvent", + qmlRegisterType(uri, major, minor, "MapQuickItem"); + qmlRegisterType(uri, major, minor, "MapItemView"); + + qmlRegisterType(uri, major, minor, "GeocodeModel"); // geocoding and reverse geocoding + qmlRegisterType(uri, major, minor, "RouteModel"); + qmlRegisterType(uri, major, minor, "RouteQuery"); + qmlRegisterType(uri, major, minor, "Route"); // data type + qmlRegisterType(uri, major, minor, "RouteSegment"); + qmlRegisterType(uri, major, minor, "RouteManeuver"); + qmlRegisterUncreatableType(uri, major, minor, "MapPinchEvent", QStringLiteral("(Map)PinchEvent is not intended instantiable by developer.")); - qmlRegisterUncreatableType(uri, 5, 0, "MapGestureArea", + qmlRegisterUncreatableType(uri, major, minor, "MapGestureArea", QStringLiteral("(Map)HestureArea is not intended instantiable by developer.")); - qmlRegisterUncreatableType(uri, 5, 0, "MapType", + qmlRegisterUncreatableType(uri, major, minor, "MapType", QStringLiteral("MapType is not intended instantiable by developer.")); - qmlRegisterType(uri, 5, 0, "Category"); - qmlRegisterType(uri, 5, 0, "EditorialModel"); - qmlRegisterType(uri, 5, 0, "ImageModel"); - qmlRegisterType(uri, 5, 0, "Place"); - qmlRegisterType(uri, 5, 0, "Icon"); - qmlRegisterType(uri, 5, 0, "Ratings"); - qmlRegisterType(uri, 5, 0, "ReviewModel"); - qmlRegisterType(uri, 5, 0, "Supplier"); - qmlRegisterType(uri, 5, 0, "User"); - qmlRegisterType(uri, 5, 0, "MapRectangle"); - qmlRegisterType(uri, 5, 0, "MapCircle"); + qmlRegisterType(uri, major, minor, "Category"); + qmlRegisterType(uri, major, minor, "EditorialModel"); + qmlRegisterType(uri, major, minor, "ImageModel"); + qmlRegisterType(uri, major, minor, "Place"); + qmlRegisterType(uri, major, minor, "Icon"); + qmlRegisterType(uri, major, minor, "Ratings"); + qmlRegisterType(uri, major, minor, "ReviewModel"); + qmlRegisterType(uri, major, minor, "Supplier"); + qmlRegisterType(uri, major, minor, "User"); + qmlRegisterType(uri, major, minor, "MapRectangle"); + qmlRegisterType(uri, major, minor, "MapCircle"); qmlRegisterType(); - qmlRegisterType(uri, 5, 0, "MapPolyline"); - qmlRegisterType(uri, 5, 0, "MapPolygon"); - qmlRegisterType(uri, 5, 0, "MapRoute"); - - qmlRegisterType(uri, 5, 0, "CategoryModel"); - qmlRegisterType(uri, 5, 0, "PlaceSearchModel"); - qmlRegisterType(uri, 5, 0, "PlaceSearchSuggestionModel"); - qmlRegisterType(uri, 5,0, "PlaceAttribute"); - qmlRegisterUncreatableType(uri, 5, 0, "ExtendedAttributes", "ExtendedAttributes instances cannot be instantiated. " + qmlRegisterType(uri, major, minor, "MapPolyline"); + qmlRegisterType(uri, major, minor, "MapPolygon"); + qmlRegisterType(uri, major, minor, "MapRoute"); + + qmlRegisterType(uri, major, minor, "CategoryModel"); + qmlRegisterType(uri, major, minor, "PlaceSearchModel"); + qmlRegisterType(uri, major, minor, "PlaceSearchSuggestionModel"); + qmlRegisterType(uri, major, minor, "PlaceAttribute"); + qmlRegisterUncreatableType(uri, major, minor, "ExtendedAttributes", "ExtendedAttributes instances cannot be instantiated. " "Only Place types have ExtendedAttributes and they cannot be re-assigned " "(but can be modified)."); - qmlRegisterType(uri, 5, 0, "ContactDetail"); - qmlRegisterUncreatableType(uri, 5, 0, "ContactDetails", "ContactDetails instances cannot be instantiated. " + qmlRegisterType(uri, major, minor, "ContactDetail"); + qmlRegisterUncreatableType(uri, major, minor, "ContactDetails", "ContactDetails instances cannot be instantiated. " "Only Place types have ContactDetails and they cannot " "be re-assigned (but can be modified)."); + + // Register the 5.3 types + // 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 = 3; + // For now there are no new types; just reregister one existing 5.0 type + qmlRegisterType(uri, major, minor, "Plugin"); + + //registrations below are version independent qRegisterMetaType("QPlaceCategory"); qRegisterMetaType("QPlace"); qRegisterMetaType("QPlaceIcon"); diff --git a/src/imports/location/plugins.qmltypes b/src/imports/location/plugins.qmltypes index c4319665..ffdbd7c8 100644 --- a/src/imports/location/plugins.qmltypes +++ b/src/imports/location/plugins.qmltypes @@ -3,7 +3,8 @@ import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // -// This file was auto-generated with the command 'qmlplugindump -notrelocatable QtLocation 5.0'. +// This file was auto-generated by: +// 'qmlplugindump -notrelocatable QtLocation 5.3' Module { Component { @@ -85,6 +86,7 @@ Module { name: "QDeclarativeContactDetails" prototype: "QQmlPropertyMap" exports: ["QtLocation/ContactDetails 5.0"] + isCreatable: false exportMetaObjectRevisions: [0] } Component { @@ -131,8 +133,8 @@ Module { isPointer: true } Property { name: "plugin"; type: "QDeclarativeGeoServiceProvider"; isPointer: true } - Property { name: "minimumZoomLevel"; type: "double"; isReadonly: true } - Property { name: "maximumZoomLevel"; type: "double"; isReadonly: true } + Property { name: "minimumZoomLevel"; type: "double" } + Property { name: "maximumZoomLevel"; type: "double" } Property { name: "zoomLevel"; type: "double" } Property { name: "activeMapType"; type: "QDeclarativeGeoMapType"; isPointer: true } Property { @@ -143,8 +145,6 @@ Module { } Property { name: "center"; type: "QGeoCoordinate" } Property { name: "mapItems"; type: "QList"; isReadonly: true } - Property { name: "tilt"; type: "double" } - Property { name: "bearing"; type: "double" } Signal { name: "wheelAngleChanged" Parameter { name: "angleDelta"; type: "QPoint" } @@ -157,14 +157,6 @@ Module { name: "zoomLevelChanged" Parameter { name: "zoomLevel"; type: "double" } } - Signal { - name: "bearingChanged" - Parameter { name: "bearing"; type: "double" } - } - Signal { - name: "tiltChanged" - Parameter { name: "tilt"; type: "double" } - } Signal { name: "centerChanged" Parameter { name: "coordinate"; type: "QGeoCoordinate" } @@ -188,6 +180,10 @@ Module { type: "QPointF" Parameter { name: "coordinate"; type: "QGeoCoordinate" } } + Method { + name: "fitViewportToGeoShape" + Parameter { name: "shape"; type: "QVariant" } + } Method { name: "fitViewportToMapItems" } Method { name: "pan" @@ -200,16 +196,15 @@ Module { name: "QDeclarativeGeoMapGestureArea" prototype: "QObject" exports: ["QtLocation/MapGestureArea 5.0"] + isCreatable: false exportMetaObjectRevisions: [0] Enum { name: "ActiveGesture" values: { "NoGesture": 0, "ZoomGesture": 1, - "RotationGesture": 2, - "TiltGesture": 4, - "PanGesture": 8, - "FlickGesture": 16 + "PanGesture": 2, + "FlickGesture": 4 } } Enum { @@ -217,20 +212,17 @@ Module { values: { "NoGesture": 0, "ZoomGesture": 1, - "RotationGesture": 2, - "TiltGesture": 4, - "PanGesture": 8, - "FlickGesture": 16 + "PanGesture": 2, + "FlickGesture": 4 } } Property { name: "enabled"; type: "bool" } Property { name: "pinchEnabled"; type: "bool" } Property { name: "panEnabled"; type: "bool" } - Property { name: "isPinchActive"; type: "bool" } + Property { name: "isPinchActive"; type: "bool"; isReadonly: true } Property { name: "isPanActive"; type: "bool"; isReadonly: true } Property { name: "activeGestures"; type: "ActiveGestures" } Property { name: "maximumZoomLevelChange"; type: "double" } - Property { name: "rotationFactor"; type: "double" } Property { name: "flickDeceleration"; type: "double" } Signal { name: "pinchActiveChanged" } Signal { @@ -256,6 +248,7 @@ Module { defaultProperty: "data" prototype: "QQuickItem" exports: ["QtLocation/GeoMapItemBase 5.0"] + isCreatable: false exportMetaObjectRevisions: [0] } Component { @@ -267,36 +260,11 @@ Module { Property { name: "delegate"; type: "QQmlComponent"; isPointer: true } Property { name: "autoFitViewport"; type: "bool" } } - Component { - name: "QDeclarativeGeoMapMouseArea" - defaultProperty: "data" - prototype: "QQuickMouseArea" - exports: ["QtLocation/MapMouseArea 5.0"] - exportMetaObjectRevisions: [0] - Method { - name: "mouseToCoordinate" - type: "QGeoCoordinate" - Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true } - } - } - Component { - name: "QDeclarativeGeoMapMouseEvent" - prototype: "QObject" - exports: ["QtLocation/MapMouseEvent 5.0"] - exportMetaObjectRevisions: [0] - Property { name: "accepted"; type: "bool" } - Property { name: "button"; type: "int"; isReadonly: true } - Property { name: "buttons"; type: "int"; isReadonly: true } - Property { name: "modifiers"; type: "int"; isReadonly: true } - Property { name: "wasHeld"; type: "bool"; isReadonly: true } - Property { name: "x"; type: "int"; isReadonly: true } - Property { name: "y"; type: "int"; isReadonly: true } - Property { name: "coordinate"; type: "QGeoCoordinate"; isReadonly: true } - } Component { name: "QDeclarativeGeoMapPinchEvent" prototype: "QObject" exports: ["QtLocation/MapPinchEvent 5.0"] + isCreatable: false exportMetaObjectRevisions: [0] Property { name: "center"; type: "QPointF"; isReadonly: true } Property { name: "angle"; type: "double"; isReadonly: true } @@ -320,6 +288,7 @@ Module { name: "QDeclarativeGeoMapType" prototype: "QObject" exports: ["QtLocation/MapType 5.0"] + isCreatable: false exportMetaObjectRevisions: [0] Enum { name: "MapStyle" @@ -332,6 +301,8 @@ Module { "HybridMap": 5, "TransitMap": 6, "GrayStreetMap": 7, + "PedestrianMap": 8, + "CarNavigationMap": 9, "CustomMap": 100 } } @@ -383,6 +354,7 @@ Module { Property { name: "status"; type: "Status"; isReadonly: true } Property { name: "errorString"; type: "string"; isReadonly: true } Property { name: "error"; type: "RouteError"; isReadonly: true } + Property { name: "measurementSystem"; type: "QLocale::MeasurementSystem" } Signal { name: "routesChanged" } Method { name: "update" } Method { @@ -541,8 +513,8 @@ Module { name: "QDeclarativeGeoServiceProvider" defaultProperty: "parameters" prototype: "QObject" - exports: ["QtLocation/Plugin 5.0"] - exportMetaObjectRevisions: [0] + exports: ["QtLocation/Plugin 5.0", "QtLocation/Plugin 5.3"] + exportMetaObjectRevisions: [0, 0] Enum { name: "RoutingFeature" values: { @@ -723,6 +695,7 @@ Module { name: "QDeclarativeGeoServiceProviderRequirements" prototype: "QObject" exports: ["QtLocation/PluginRequirements 5.0"] + isCreatable: false exportMetaObjectRevisions: [0] Property { name: "mapping"; type: "QDeclarativeGeoServiceProvider::MappingFeatures" } Property { name: "routing"; type: "QDeclarativeGeoServiceProvider::RoutingFeatures" } @@ -1063,13 +1036,16 @@ Module { } Property { name: "plugin"; type: "QDeclarativeGeoServiceProvider"; isPointer: true } Property { name: "searchArea"; type: "QVariant" } - Property { name: "offset"; type: "int" } Property { name: "limit"; type: "int" } + Property { name: "previousPagesAvailable"; type: "bool"; isReadonly: true } + Property { name: "nextPagesAvailable"; type: "bool"; isReadonly: true } Property { name: "status"; type: "Status"; isReadonly: true } Method { name: "update" } Method { name: "cancel" } Method { name: "reset" } Method { name: "errorString"; type: "string" } + Method { name: "previousPage" } + Method { name: "nextPage" } } Component { name: "QDeclarativeSearchResultModel" @@ -1170,6 +1146,7 @@ Module { name: "QQmlPropertyMap" prototype: "QObject" exports: ["QtLocation/ExtendedAttributes 5.0"] + isCreatable: false exportMetaObjectRevisions: [0] Signal { name: "valueChanged" -- cgit v1.2.1