summaryrefslogtreecommitdiffstats
path: root/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp')
-rw-r--r--examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp b/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp
index 1b65c87f5f..32f4194635 100644
--- a/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp
+++ b/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp
@@ -10,10 +10,11 @@ BindableSubscription::BindableSubscription(BindableUser *user) : m_user(user)
{
Q_ASSERT(user);
- m_price.setBinding([this] { return qRound(calculateDiscount() * m_duration * basePrice()); });
+ m_price.setBinding(
+ [this] { return qRound(calculateDiscount() * int(m_duration) * basePrice()); });
m_isValid.setBinding([this] {
- return m_user->country() != BindableUser::None && m_user->age() > 12;
+ return m_user->country() != BindableUser::Country::AnyCountry && m_user->age() > 12;
});
}
@@ -38,14 +39,13 @@ double BindableSubscription::calculateDiscount() const
case Yearly:
return 0.6;
}
- Q_ASSERT(false);
- return -1;
+ Q_UNREACHABLE_RETURN(-1);
}
int BindableSubscription::basePrice() const
{
- if (m_user->country() == BindableUser::None)
+ if (m_user->country() == BindableUser::Country::AnyCountry)
return 0;
- return (m_user->country() == BindableUser::Norway) ? 100 : 80;
+ return (m_user->country() == BindableUser::Country::Norway) ? 100 : 80;
}