From ad6fd04609c94373ace8711f8e10c322b68436b2 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Fri, 21 Jul 2023 19:41:39 +0300 Subject: [PATCH] examples/: fix compiler warnings -Wdeprecated-enum-float-conversion This is with GCC. Change-Id: I52dcb6881f36c740129b699db7db9241a4e75da1 Reviewed-by: Thiago Macieira --- .../bindablesubscription/bindablesubscription.cpp | 3 ++- .../corelib/bindableproperties/subscription/subscription.cpp | 2 +- examples/corelib/threads/mandelbrot/renderthread.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp b/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp index 8b8321859b..32f4194635 100644 --- a/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp +++ b/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp @@ -10,7 +10,8 @@ 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::Country::AnyCountry && m_user->age() > 12; diff --git a/examples/corelib/bindableproperties/subscription/subscription.cpp b/examples/corelib/bindableproperties/subscription/subscription.cpp index 5d040f76d9..85cc5798cc 100644 --- a/examples/corelib/bindableproperties/subscription/subscription.cpp +++ b/examples/corelib/bindableproperties/subscription/subscription.cpp @@ -15,7 +15,7 @@ void Subscription::calculatePrice() { const auto oldPrice = m_price; - m_price = qRound(calculateDiscount() * m_duration * basePrice()); + m_price = qRound(calculateDiscount() * int(m_duration) * basePrice()); if (m_price != oldPrice) emit priceChanged(); } diff --git a/examples/corelib/threads/mandelbrot/renderthread.h b/examples/corelib/threads/mandelbrot/renderthread.h index 6e509eee94..ecd8ae084d 100644 --- a/examples/corelib/threads/mandelbrot/renderthread.h +++ b/examples/corelib/threads/mandelbrot/renderthread.h @@ -49,7 +49,7 @@ private: bool restart = false; bool abort = false; - enum { ColormapSize = 512 }; + static constexpr int ColormapSize = 512; uint colormap[ColormapSize]; }; //! [0]