diff options
author | James DeLisle <james.delisle@qt.io> | 2023-02-28 16:31:13 -0500 |
---|---|---|
committer | James DeLisle <james.delisle@qt.io> | 2023-03-09 12:27:00 -0500 |
commit | ed6a3ce0afe639fb40eb6f032b85e90fe35f1cb3 (patch) | |
tree | 76db7d4b7d9db3c757944e5036c78e1e267b2545 /examples/corelib/bindableproperties/bindablesubscription/bindableuser.h | |
parent | de5e0422ca14ad1bc042889fa68772bf6912a215 (diff) |
Update the bindable properties example
- Fix the number of months in each duration
- Move the user Country enum to use QLocale::Territory
- Properly calculate the cost per month to match the UI label
- Use QLocale to format the price display text
- Fix some misspellings and grammar in the doc
Pick-to: 6.2 6.5
Change-Id: I78a64f344073070cd94d5cb4a8a4c7c13afa337f
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/corelib/bindableproperties/bindablesubscription/bindableuser.h')
-rw-r--r-- | examples/corelib/bindableproperties/bindablesubscription/bindableuser.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/examples/corelib/bindableproperties/bindablesubscription/bindableuser.h b/examples/corelib/bindableproperties/bindablesubscription/bindableuser.h index b7e44d52ec..d172a7cb22 100644 --- a/examples/corelib/bindableproperties/bindablesubscription/bindableuser.h +++ b/examples/corelib/bindableproperties/bindablesubscription/bindableuser.h @@ -4,6 +4,7 @@ #ifndef BINDABLEUSER_H #define BINDABLEUSER_H +#include <QLocale> #include <QProperty> //! [bindable-user-class] @@ -11,13 +12,9 @@ class BindableUser { public: - enum Country { - None, - Finland, - Germany, - Norway, - }; + using Country = QLocale::Territory; +public: BindableUser() = default; BindableUser(const BindableUser &) = delete; @@ -30,7 +27,7 @@ public: QBindable<int> bindableAge() { return &m_age; } private: - QProperty<Country> m_country { None }; + QProperty<Country> m_country { QLocale::AnyTerritory }; QProperty<int> m_age { 0 }; }; |