diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-02-24 09:22:38 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-26 16:29:16 +0100 |
commit | 450793356b6f62b70a896b85011070760c5d1d56 (patch) | |
tree | 15e4f006f947087e708ea1ed5775a0372446cf83 | |
parent | 1ca75bd6bc109c6e5ad47fd5c236709d3f64c466 (diff) | |
download | qtlocation-450793356b6f62b70a896b85011070760c5d1d56.tar.gz |
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 <mccarthy.aaron@gmail.com>
-rw-r--r-- | src/imports/location/location.cpp | 100 | ||||
-rw-r--r-- | 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<QDeclarativeGeoServiceProvider>(uri, 5, 0, "Plugin"); - qmlRegisterType<QDeclarativeGeoServiceProviderParameter>(uri, 5, 0, "PluginParameter"); - qmlRegisterUncreatableType<QDeclarativeGeoServiceProviderRequirements>(uri, 5, 0, "PluginRequirements", + // Register the 5.0 types + // 5.0 is siltent and not advertised + + qmlRegisterType<QDeclarativeGeoServiceProvider >(uri, major, minor, "Plugin"); + qmlRegisterType<QDeclarativeGeoServiceProviderParameter >(uri, major, minor, "PluginParameter"); + qmlRegisterUncreatableType<QDeclarativeGeoServiceProviderRequirements>(uri, major, minor, "PluginRequirements", QStringLiteral("PluginRequirements is not intended instantiable by developer.")); - qmlRegisterType<QDeclarativeGeoMap>(uri, 5, 0, "Map"); + qmlRegisterType<QDeclarativeGeoMap >(uri, major, minor, "Map"); - qmlRegisterUncreatableType<QDeclarativeGeoMapItemBase>(uri, 5, 0, "GeoMapItemBase", + qmlRegisterUncreatableType<QDeclarativeGeoMapItemBase >(uri, major, minor, "GeoMapItemBase", QStringLiteral("HeoMapItemBase is not intended instantiable by developer.")); - qmlRegisterType<QDeclarativeGeoMapQuickItem>(uri, 5, 0, "MapQuickItem"); - qmlRegisterType<QDeclarativeGeoMapItemView>(uri, 5, 0, "MapItemView"); - - qmlRegisterType<QDeclarativeGeocodeModel>(uri, 5, 0, "GeocodeModel"); // geocoding and reverse geocoding - qmlRegisterType<QDeclarativeGeoRouteModel>(uri, 5, 0, "RouteModel"); - qmlRegisterType<QDeclarativeGeoRouteQuery>(uri, 5, 0, "RouteQuery"); - qmlRegisterType<QDeclarativeGeoRoute>(uri, 5, 0, "Route"); // data type - qmlRegisterType<QDeclarativeGeoRouteSegment>(uri, 5, 0, "RouteSegment"); - qmlRegisterType<QDeclarativeGeoManeuver>(uri, 5, 0, "RouteManeuver"); - qmlRegisterUncreatableType<QDeclarativeGeoMapPinchEvent>(uri, 5, 0, "MapPinchEvent", + 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 + qmlRegisterType<QDeclarativeGeoRouteSegment >(uri, major, minor, "RouteSegment"); + qmlRegisterType<QDeclarativeGeoManeuver >(uri, major, minor, "RouteManeuver"); + qmlRegisterUncreatableType<QDeclarativeGeoMapPinchEvent >(uri, major, minor, "MapPinchEvent", QStringLiteral("(Map)PinchEvent is not intended instantiable by developer.")); - qmlRegisterUncreatableType<QDeclarativeGeoMapGestureArea>(uri, 5, 0, "MapGestureArea", + qmlRegisterUncreatableType<QDeclarativeGeoMapGestureArea>(uri, major, minor, "MapGestureArea", QStringLiteral("(Map)HestureArea is not intended instantiable by developer.")); - qmlRegisterUncreatableType<QDeclarativeGeoMapType>(uri, 5, 0, "MapType", + qmlRegisterUncreatableType<QDeclarativeGeoMapType >(uri, major, minor, "MapType", QStringLiteral("MapType is not intended instantiable by developer.")); - qmlRegisterType<QDeclarativeCategory>(uri, 5, 0, "Category"); - qmlRegisterType<QDeclarativePlaceEditorialModel>(uri, 5, 0, "EditorialModel"); - qmlRegisterType<QDeclarativePlaceImageModel>(uri, 5, 0, "ImageModel"); - qmlRegisterType<QDeclarativePlace>(uri, 5, 0, "Place"); - qmlRegisterType<QDeclarativePlaceIcon>(uri, 5, 0, "Icon"); - qmlRegisterType<QDeclarativeRatings>(uri, 5, 0, "Ratings"); - qmlRegisterType<QDeclarativeReviewModel>(uri, 5, 0, "ReviewModel"); - qmlRegisterType<QDeclarativeSupplier>(uri, 5, 0, "Supplier"); - qmlRegisterType<QDeclarativePlaceUser>(uri, 5, 0, "User"); - qmlRegisterType<QDeclarativeRectangleMapItem>(uri, 5, 0, "MapRectangle"); - qmlRegisterType<QDeclarativeCircleMapItem>(uri, 5, 0, "MapCircle"); + 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<QDeclarativePlaceIcon >(uri, major, minor, "Icon"); + qmlRegisterType<QDeclarativeRatings >(uri, major, minor, "Ratings"); + qmlRegisterType<QDeclarativeReviewModel >(uri, major, minor, "ReviewModel"); + qmlRegisterType<QDeclarativeSupplier >(uri, major, minor, "Supplier"); + qmlRegisterType<QDeclarativePlaceUser >(uri, major, minor, "User"); + qmlRegisterType<QDeclarativeRectangleMapItem >(uri, major, minor, "MapRectangle"); + qmlRegisterType<QDeclarativeCircleMapItem >(uri, major, minor, "MapCircle"); qmlRegisterType<QDeclarativeMapLineProperties>(); - qmlRegisterType<QDeclarativePolylineMapItem>(uri, 5, 0, "MapPolyline"); - qmlRegisterType<QDeclarativePolygonMapItem>(uri, 5, 0, "MapPolygon"); - qmlRegisterType<QDeclarativeRouteMapItem>(uri, 5, 0, "MapRoute"); - - qmlRegisterType<QDeclarativeSupportedCategoriesModel>(uri, 5, 0, "CategoryModel"); - qmlRegisterType<QDeclarativeSearchResultModel>(uri, 5, 0, "PlaceSearchModel"); - qmlRegisterType<QDeclarativeSearchSuggestionModel>(uri, 5, 0, "PlaceSearchSuggestionModel"); - qmlRegisterType<QDeclarativePlaceAttribute>(uri, 5,0, "PlaceAttribute"); - qmlRegisterUncreatableType<QQmlPropertyMap>(uri, 5, 0, "ExtendedAttributes", "ExtendedAttributes instances cannot be instantiated. " + 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"); + qmlRegisterType<QDeclarativePlaceAttribute >(uri, major, minor, "PlaceAttribute"); + 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)."); - qmlRegisterType<QDeclarativeContactDetail>(uri, 5, 0, "ContactDetail"); - qmlRegisterUncreatableType<QDeclarativeContactDetails>(uri, 5, 0, "ContactDetails", "ContactDetails instances cannot be instantiated. " + qmlRegisterType<QDeclarativeContactDetail >(uri, major, minor, "ContactDetail"); + 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)."); + + // 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<QDeclarativeGeoServiceProvider >(uri, major, minor, "Plugin"); + + //registrations below are version independent qRegisterMetaType<QPlaceCategory>("QPlaceCategory"); qRegisterMetaType<QPlace>("QPlace"); qRegisterMetaType<QPlaceIcon>("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<QObject*>"; isReadonly: true } - Property { name: "tilt"; type: "double" } - Property { name: "bearing"; type: "double" } Signal { name: "wheelAngleChanged" Parameter { name: "angleDelta"; type: "QPoint" } @@ -158,14 +158,6 @@ Module { 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 { @@ -268,35 +261,10 @@ Module { 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" |