diff options
author | abcd <amos.choy@nokia.com> | 2012-08-17 13:56:48 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-24 07:25:02 +0200 |
commit | 35d0cea56da57aae312a5e0b92d7e9ab243dbffa (patch) | |
tree | 4280063b86c6c77621e6c9770dcaaf2042ce2f17 /src/imports | |
parent | 72dd61d45aa05512d66eb154df150cb20b35ba8f (diff) | |
download | qtlocation-35d0cea56da57aae312a5e0b92d7e9ab243dbffa.tar.gz |
Document and enforce that ExtendedAttributes are not instantiable
ExtendedAttributes are read-only properties of Places and so
cannot be created or reassigned, but they can be modified.
Explictly mention this in the documentation and register
ExtendedAttributes as an uncreatable type.
Change-Id: Ib48d4365a5232e7a11518720e2f04b039f92d40d
Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/location/declarativeplaces/qdeclarativeplaceattribute.cpp | 5 | ||||
-rw-r--r-- | src/imports/location/location.cpp | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/imports/location/declarativeplaces/qdeclarativeplaceattribute.cpp b/src/imports/location/declarativeplaces/qdeclarativeplaceattribute.cpp index 5d838386..466e334d 100644 --- a/src/imports/location/declarativeplaces/qdeclarativeplaceattribute.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativeplaceattribute.cpp @@ -80,6 +80,11 @@ Some attributes may not be intended to be readable by end users, the label field of such attributes is empty to indicate this fact. + \note ExtendedAttributes instances are only ever used in the context of \l {Place}s. It is not + possible to create an ExtendedAttributes instance directly or re-assign a \l {Place}'s + ExtendedAttributes property. Modification of ExtendedAttributes can only be accomplished + via Javascript. + The following example shows how to access all \l {PlaceAttribute}{PlaceAttributes} and print them to the console: diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp index af93204a..8c510200 100644 --- a/src/imports/location/location.cpp +++ b/src/imports/location/location.cpp @@ -182,6 +182,9 @@ public: 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. " + "Only Place types have ExtendedAttributes and they cannot be re-assigned " + "(but can be modified)."); qmlRegisterType<QDeclarativeContactDetail>(uri, 5, 0, "ContactDetail"); qRegisterMetaType<QGeoCoordinate>("QGeoCoordinate"); |