From 7779e6a05cde72320e47cf4d5ebed78b9e049226 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 29 Sep 2022 12:49:07 +0200 Subject: Declare value types as structured values, remove workarounds Use QML's new support for initializing structured values, adjust tests, and remove the now unnecessary conversion functions. Change-Id: I7007c9acb50f4a9532a9eed847b1b4dd0928ba34 Reviewed-by: Ulf Hermann --- src/location/places/qplaceattribute.h | 1 + src/location/places/qplacecontactdetail.h | 1 + src/location/places/qplaceicon.h | 2 ++ src/location/places/qplaceratings.h | 2 ++ src/location/places/qplacesupplier.h | 2 ++ src/location/places/qplaceuser.h | 2 ++ 6 files changed, 10 insertions(+) (limited to 'src/location/places') diff --git a/src/location/places/qplaceattribute.h b/src/location/places/qplaceattribute.h index 5e628f26..6d8820d8 100644 --- a/src/location/places/qplaceattribute.h +++ b/src/location/places/qplaceattribute.h @@ -56,6 +56,7 @@ class Q_LOCATION_EXPORT QPlaceAttribute { Q_GADGET QML_VALUE_TYPE(placeAttribute) + QML_STRUCTURED_VALUE 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 5801a1f0..4467c1f4 100644 --- a/src/location/places/qplacecontactdetail.h +++ b/src/location/places/qplacecontactdetail.h @@ -56,6 +56,7 @@ class Q_LOCATION_EXPORT QPlaceContactDetail { Q_GADGET QML_VALUE_TYPE(contactDetail) + QML_STRUCTURED_VALUE 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 2360553c..f39b5ea6 100644 --- a/src/location/places/qplaceicon.h +++ b/src/location/places/qplaceicon.h @@ -59,6 +59,8 @@ class Q_LOCATION_EXPORT QPlaceIcon { Q_GADGET QML_VALUE_TYPE(icon) + QML_STRUCTURED_VALUE + 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 6a73fb9a..396ac1b8 100644 --- a/src/location/places/qplaceratings.h +++ b/src/location/places/qplaceratings.h @@ -54,6 +54,8 @@ class Q_LOCATION_EXPORT QPlaceRatings { Q_GADGET QML_VALUE_TYPE(ratings) + QML_STRUCTURED_VALUE + 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 81a4aff5..e9a942ec 100644 --- a/src/location/places/qplacesupplier.h +++ b/src/location/places/qplacesupplier.h @@ -56,6 +56,8 @@ class Q_LOCATION_EXPORT QPlaceSupplier { Q_GADGET QML_VALUE_TYPE(supplier) + QML_STRUCTURED_VALUE + 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 6dcca89b..871ad95b 100644 --- a/src/location/places/qplaceuser.h +++ b/src/location/places/qplaceuser.h @@ -54,6 +54,8 @@ class Q_LOCATION_EXPORT QPlaceUser { Q_GADGET QML_VALUE_TYPE(user) + QML_STRUCTURED_VALUE + Q_PROPERTY(QString userId READ userId WRITE setUserId) Q_PROPERTY(QString name READ name WRITE setName) -- cgit v1.2.1