aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-05-17 14:40:00 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-06-01 15:06:06 +0200
commitc41fe1592fea0afa805d6b1ed07791acc5113379 (patch)
tree64729e596943a19db5fb31410cf48431bdd46105 /src/qml
parentec1dc0ed933a8270ec59ff69c41987862398ea2d (diff)
QmlCompiler: Detect non-integral values when accessing QQmlListProperty
Fixes: QTBUG-103560 Change-Id: Ifcc73baf7f79e30f6e83ff3e500dd39f95790bfe Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> (cherry picked from commit 4a10e1d84ac948fb9a50cd2e44fcbeaef972e5ea)
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/common/qjsnumbercoercion.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/qml/common/qjsnumbercoercion.h b/src/qml/common/qjsnumbercoercion.h
index 2517442bb6..0e233747ff 100644
--- a/src/qml/common/qjsnumbercoercion.h
+++ b/src/qml/common/qjsnumbercoercion.h
@@ -48,6 +48,10 @@ QT_BEGIN_NAMESPACE
class QJSNumberCoercion
{
public:
+ static constexpr bool isInteger(double d) {
+ return equals(d, d) && equals(static_cast<int>(d), d);
+ }
+
static constexpr int toInteger(double d) {
if (!equals(d, d))
return 0;