aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/common/qjsnumbercoercion.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/common/qjsnumbercoercion.h')
-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;