diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> | 2014-03-20 10:05:16 +0100 |
---|---|---|
committer | Andy Nichols <andy.nichols@digia.com> | 2014-03-20 13:45:11 +0200 |
commit | a2f33195fa02233df0ae8a382969ea21276156a5 (patch) | |
tree | 799a0dc165e55245369c7a80a078b988b2e62657 /src/imports/purchasing/qinappproductqmltype_p.h | |
parent | ebc0d7669e5805864918b418d8e3aeb38f7d2bdd (diff) |
Make it possible to create products outside store
The current API did not allow for the use case of creating
products from a model in a convenient way, since there was
no way of setting the store pointer except to set the
parent of the objects, which is hacky.
This adds explicitly setting the store as an option.
Change-Id: Id98a9d646afa8818122b73e8bf4aac61e90a4cab
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Diffstat (limited to 'src/imports/purchasing/qinappproductqmltype_p.h')
-rw-r--r-- | src/imports/purchasing/qinappproductqmltype_p.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/imports/purchasing/qinappproductqmltype_p.h b/src/imports/purchasing/qinappproductqmltype_p.h index 4cc0e02..d055ec2 100644 --- a/src/imports/purchasing/qinappproductqmltype_p.h +++ b/src/imports/purchasing/qinappproductqmltype_p.h @@ -27,8 +27,8 @@ QT_BEGIN_NAMESPACE -class QInAppStore; class QInAppTransaction; +class QInAppStoreQmlType; class QInAppProductQmlType : public QObject, public QQmlParserStatus { Q_OBJECT @@ -38,6 +38,7 @@ class QInAppProductQmlType : public QObject, public QQmlParserStatus Q_PROPERTY(QString title READ title NOTIFY titleChanged) Q_PROPERTY(QString description READ description NOTIFY descriptionChanged) Q_PROPERTY(Status status READ status NOTIFY statusChanged) + Q_PROPERTY(QInAppStoreQmlType *store READ store WRITE setStore NOTIFY storeChanged) public: enum Status { Uninitialized, @@ -59,7 +60,8 @@ public: QString title() const; QString description() const; - void setStore(QInAppStore *store); + void setStore(QInAppStoreQmlType *store); + QInAppStoreQmlType *store() const; Q_SIGNALS: void purchaseSucceeded(QInAppTransaction *transaction); @@ -70,6 +72,7 @@ Q_SIGNALS: void priceChanged(); void titleChanged(); void descriptionChanged(); + void storeChanged(); protected: void componentComplete(); @@ -89,7 +92,7 @@ private: QInAppProduct::ProductType m_requiredType; bool m_componentComplete; - QInAppStore *m_store; + QInAppStoreQmlType *m_store; QInAppProduct *m_product; }; |