aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqml.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-07-27 15:10:31 +0200
committerUlf Hermann <ulf.hermann@qt.io>2023-08-18 14:26:04 +0200
commit0f23346d2a660404d40d02a2d101eb4fc21c8b02 (patch)
treecbff50164ae4220ddd2d5db8e3ad26136c89e1c6 /src/qml/qml/qqml.cpp
parent37655a6e95153a7647d7c62614d4a81d734973d3 (diff)
QmlCompiler: Allow construction of Date objects
We map Date to QDateTime and special-case its constructors. Task-number: QTBUG-111624 Change-Id: I0496f853613da3ccee9b6f6c4cf0adffa064f9f8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/qml/qml/qqml.cpp')
-rw-r--r--src/qml/qml/qqml.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp
index 1e051fd37a..e7de0c85ca 100644
--- a/src/qml/qml/qqml.cpp
+++ b/src/qml/qml/qqml.cpp
@@ -6,21 +6,22 @@
#include <QtQml/qqmlprivate.h>
#include <private/qjsvalue_p.h>
+#include <private/qqmlbuiltinfunctions_p.h>
+#include <private/qqmlcomponent_p.h>
#include <private/qqmlengine_p.h>
+#include <private/qqmlfinalizer_p.h>
+#include <private/qqmlloggingcategory_p.h>
#include <private/qqmlmetatype_p.h>
#include <private/qqmlmetatypedata_p.h>
#include <private/qqmltype_p_p.h>
#include <private/qqmltypemodule_p.h>
-#include <private/qqmlcomponent_p.h>
#include <private/qqmltypewrapper_p.h>
#include <private/qqmlvaluetypewrapper_p.h>
+#include <private/qv4dateobject_p.h>
+#include <private/qv4errorobject_p.h>
+#include <private/qv4identifiertable_p.h>
#include <private/qv4lookup_p.h>
#include <private/qv4qobjectwrapper_p.h>
-#include <private/qv4identifiertable_p.h>
-#include <private/qv4errorobject_p.h>
-#include <private/qqmlbuiltinfunctions_p.h>
-#include <private/qqmlfinalizer_p.h>
-#include <private/qqmlloggingcategory_p.h>
#include <QtCore/qmutex.h>
@@ -1500,7 +1501,25 @@ QVariant AOTCompiledContext::constructValueType(
int ctorIndex, void *ctorArg) const
{
return QQmlValueTypeProvider::constructValueType(
- resultMetaType, resultMetaObject, ctorIndex, ctorArg);
+ resultMetaType, resultMetaObject, ctorIndex, ctorArg);
+}
+
+QDateTime AOTCompiledContext::constructDateTime(double timestamp) const
+{
+ return QV4::DateObject::timestampToDateTime(timestamp);
+}
+
+QDateTime AOTCompiledContext::constructDateTime(const QString &string) const
+{
+ return QV4::DateObject::stringToDateTime(string, engine->handle());
+}
+
+QDateTime AOTCompiledContext::constructDateTime(
+ double year, double month, double day, double hours,
+ double minutes, double seconds, double msecs) const
+{
+ return constructDateTime(QV4::DateObject::componentsToTimestamp(
+ year, month, day, hours, minutes, seconds, msecs, engine->handle()));
}
bool AOTCompiledContext::callQmlContextPropertyLookup(