<feed xmlns='http://www.w3.org/2005/Atom'>
<title>qt/qtdeclarative.git/src/qml/jsruntime/qv4dateobject_p.h, branch dev</title>
<subtitle>Qt Declarative (Quick 2)
</subtitle>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/'/>
<entry>
<title>JSRuntime: Don't immediately connect reference objects</title>
<updated>2025-11-13T08:00:55+00:00</updated>
<author>
<name>Olivier De Cannière</name>
<email>olivier.decanniere@qt.io</email>
</author>
<published>2025-10-15T09:29:57+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=f33d72c73ad6ab54ddfa2f73e721e600b7a43702'/>
<id>f33d72c73ad6ab54ddfa2f73e721e600b7a43702</id>
<content type='text'>
The change in a7349e6433d092398d76cafa5408753f06892cd7 reduced the
number of readbacks of reference objects by using connections to set
the dirty state only when necessary.

Establishing connections, however, comes at a cost and this introduced a
regression in the delegates_item_childrenRect QmlBench benchmark.

The mitigation introduced in this patch is to delay creating the
connection. When a reference object is created, it does not read or
create a connection but is simply marked as dirty. Only on a subsequent
read from within a different statement than the reference object's
creation's statement, does a connection get created.

This keeps the benefit of reducing unnecessary reads on objects that are
used multiple times while not spending too much on creating connections.

This brings back the benchmark to its original level of performance.

The referenceObjectChainReadsBackAsRequiredBasedOnParentSignals test
was changed to expect 8 reads instead of 4. Since all the accesses are
part of the same statement, no connection is ever created and more
reads are required than before.

The referenceObjectDoesNotFetchWithoutNotifyEventDateObject test is
reformatted to separate the assignment from the reads. Otherwise no
connection is ever created.

The referenceObjectDoesNotLeakAConnectionToTheDestroyedSignalOnANotifyBindable
test can be updated to expect 0 connections. With this change, we only
connect if the reference object is read again from a different
statement.

Amends a7349e6433d092398d76cafa5408753f06892cd7

Fixes: QTBUG-140757
Pick-to: 6.10
Change-Id: I5d02ec6266c51fbbe5f2e01405081dd5a167a833
Reviewed-by: Ulf Hermann &lt;ulf.hermann@qt.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The change in a7349e6433d092398d76cafa5408753f06892cd7 reduced the
number of readbacks of reference objects by using connections to set
the dirty state only when necessary.

Establishing connections, however, comes at a cost and this introduced a
regression in the delegates_item_childrenRect QmlBench benchmark.

The mitigation introduced in this patch is to delay creating the
connection. When a reference object is created, it does not read or
create a connection but is simply marked as dirty. Only on a subsequent
read from within a different statement than the reference object's
creation's statement, does a connection get created.

This keeps the benefit of reducing unnecessary reads on objects that are
used multiple times while not spending too much on creating connections.

This brings back the benchmark to its original level of performance.

The referenceObjectChainReadsBackAsRequiredBasedOnParentSignals test
was changed to expect 8 reads instead of 4. Since all the accesses are
part of the same statement, no connection is ever created and more
reads are required than before.

The referenceObjectDoesNotFetchWithoutNotifyEventDateObject test is
reformatted to separate the assignment from the reads. Otherwise no
connection is ever created.

The referenceObjectDoesNotLeakAConnectionToTheDestroyedSignalOnANotifyBindable
test can be updated to expect 0 connections. With this change, we only
connect if the reference object is read again from a different
statement.

Amends a7349e6433d092398d76cafa5408753f06892cd7

Fixes: QTBUG-140757
Pick-to: 6.10
Change-Id: I5d02ec6266c51fbbe5f2e01405081dd5a167a833
Reviewed-by: Ulf Hermann &lt;ulf.hermann@qt.io&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>CRA review qml/jsruntime</title>
<updated>2025-09-16T13:17:44+00:00</updated>
<author>
<name>Fabian Kosmale</name>
<email>fabian.kosmale@qt.io</email>
</author>
<published>2025-08-26T15:35:24+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=22df353c14800d2e9b6d57a9a0cb9c6baa337999'/>
<id>22df353c14800d2e9b6d57a9a0cb9c6baa337999</id>
<content type='text'>
This relies heavily on the documented fact that we only support trusted
QML/JS content, meaning most files are only significant, not critical.
This also extends to the handling of qmlc files (as in
compilationunitmapper), as we store them in a user owned, non-shared
cache directory – so any vulnerability there would already mean that an
attacker has write-priviledges on user data.

An exception is ArrayBuffer, which can be used with arbitrary user data,
and should create a valid QBA.

Fixes: QTBUG-136970
Pick-to: 6.10 6.9 6.8
QUIP: 23
Change-Id: I22033fe6ab4acf8362a8183e25b92331d45cb32c
Reviewed-by: Ulf Hermann &lt;ulf.hermann@qt.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This relies heavily on the documented fact that we only support trusted
QML/JS content, meaning most files are only significant, not critical.
This also extends to the handling of qmlc files (as in
compilationunitmapper), as we store them in a user owned, non-shared
cache directory – so any vulnerability there would already mean that an
attacker has write-priviledges on user data.

An exception is ArrayBuffer, which can be used with arbitrary user data,
and should create a valid QBA.

Fixes: QTBUG-136970
Pick-to: 6.10 6.9 6.8
QUIP: 23
Change-Id: I22033fe6ab4acf8362a8183e25b92331d45cb32c
Reviewed-by: Ulf Hermann &lt;ulf.hermann@qt.io&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Avoid unnecessary read-backs on ReferenceObjects</title>
<updated>2025-02-05T17:39:26+00:00</updated>
<author>
<name>Luca Di Sera</name>
<email>luca.disera@qt.io</email>
</author>
<published>2024-12-16T12:35:13+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=a7349e6433d092398d76cafa5408753f06892cd7'/>
<id>a7349e6433d092398d76cafa5408753f06892cd7</id>
<content type='text'>
When certain types are passed over from C++ to QML, QML converts them to
a QML usable representation that keeps track of the original data.
To do so, the QML representation of the object performs read/write-backs
when required to ensure that the representation is kept in sync with the
original data, by reading the latest data from the source or writing
back changes that are performed on the QML side.

Generally, the representation on the QML side cannot know when the
original data was modified, so that it has to read the data again each
time it accesses the representation to ensure that the latest data is
available.

The reads can be very expensive. For example, the following snippet:

```
JSON.stringify(foo)
```

Where `foo` is, for example, a `QStringList`, might need to read the data
multiple times for each element in the list.

For representations that provene from a QObject's property that has a
NOTIFY signal, it is possible to cut down on the number of reads by
reading only when the data was effectively changed since the last read,
that is, the NOTIFY signal of the property was emitted.
Similarly, if the property is a BINDABLE, we can subscribe to the
BINDABLE itself to track whether a change was performed or not.

Thus, to reduce the number of reads when possible, `ReferenceObject`,
the base representation for objects that perform read/write-backs, was
modified to take into account the NOTIFY signal or BINDABLE status of a
property when referencing data that originally provenes from a
`QObject`'s property on the C++ side.

`QObjectWrapper`, `QQmlTypeWrapper`, `ReferenceObject` and
`QMLValueTYpeWrapper` were modified with the usual `Q_MANAGED_TYPE`
macro, to allow identifying instances of those objects, which is used to
enable the new implementation.

The intializer for `ReferenceObject` was modified to behave differently
when the referenced data comes from a `QObjectWrapper`, which wraps a
`QObject` provening from C++, or a `QQmlTypeWrapper`, which can wrap a
`QObject` that is a singleton or an attached property. When it is so,
and the part of the wrapped `QObject` that is referenced is a property
that has a NOTIFY signal or is a BINDABLE, the `ReferenceObject`
instance will now connect to the signal or subscribe to the BINDABLE.

A newly added flag, `isDirty`, will be set when the signal is emitted
and is used to track whether the data has changed since our last read.

`QV4::ReferenceObject::readReference`, the base implementation for
read-backs, was modified to take into account the new "isDirty" flag.
When the flag is not set, we expect to already have the latest data, and
thus do not actually perform the read anymore.

Furthermore, the same implementation was modified to take care of
setting the `isDirty` flag to a correct state after a read is performed.

The connection to the NOTIFY signal is performed through the existing
`QQmlNotifier/Endpoint` infrastructure, which allows, between others, to
connect to signal emitted by a `QObject`, and should be more performant
than a naked connection.
Similarly, a BINDABLE is subscribed to by using its usual interface.

A new callback was added to be used by `ReferenceObject` to allow
setting the `isDirty` flag on the signal emission.

`ReferenceObject` will now store a `QQmlNotifierEndpoint` or a
`QPropertyNotifier`, that will take care of listening to upstream
changes and set the dirty flag as required.

A few bug-provening test cases where added to `tst_qqmllanguage` to test
that the number of unnecessary reads was indeed reduced.
Additional test cases were added to inspect certain aspects of the new
implementation to ensure that it works in certain common or edge cases.

The internal documentation for `ReferenceObject` was modified to mention
this new behavior.

Fixes: QTBUG-118847
Fixes: QTBUG-127322
Change-Id: Id62979ae4e03910e1165c293837e5d884727dddc
Reviewed-by: Ulf Hermann &lt;ulf.hermann@qt.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When certain types are passed over from C++ to QML, QML converts them to
a QML usable representation that keeps track of the original data.
To do so, the QML representation of the object performs read/write-backs
when required to ensure that the representation is kept in sync with the
original data, by reading the latest data from the source or writing
back changes that are performed on the QML side.

Generally, the representation on the QML side cannot know when the
original data was modified, so that it has to read the data again each
time it accesses the representation to ensure that the latest data is
available.

The reads can be very expensive. For example, the following snippet:

```
JSON.stringify(foo)
```

Where `foo` is, for example, a `QStringList`, might need to read the data
multiple times for each element in the list.

For representations that provene from a QObject's property that has a
NOTIFY signal, it is possible to cut down on the number of reads by
reading only when the data was effectively changed since the last read,
that is, the NOTIFY signal of the property was emitted.
Similarly, if the property is a BINDABLE, we can subscribe to the
BINDABLE itself to track whether a change was performed or not.

Thus, to reduce the number of reads when possible, `ReferenceObject`,
the base representation for objects that perform read/write-backs, was
modified to take into account the NOTIFY signal or BINDABLE status of a
property when referencing data that originally provenes from a
`QObject`'s property on the C++ side.

`QObjectWrapper`, `QQmlTypeWrapper`, `ReferenceObject` and
`QMLValueTYpeWrapper` were modified with the usual `Q_MANAGED_TYPE`
macro, to allow identifying instances of those objects, which is used to
enable the new implementation.

The intializer for `ReferenceObject` was modified to behave differently
when the referenced data comes from a `QObjectWrapper`, which wraps a
`QObject` provening from C++, or a `QQmlTypeWrapper`, which can wrap a
`QObject` that is a singleton or an attached property. When it is so,
and the part of the wrapped `QObject` that is referenced is a property
that has a NOTIFY signal or is a BINDABLE, the `ReferenceObject`
instance will now connect to the signal or subscribe to the BINDABLE.

A newly added flag, `isDirty`, will be set when the signal is emitted
and is used to track whether the data has changed since our last read.

`QV4::ReferenceObject::readReference`, the base implementation for
read-backs, was modified to take into account the new "isDirty" flag.
When the flag is not set, we expect to already have the latest data, and
thus do not actually perform the read anymore.

Furthermore, the same implementation was modified to take care of
setting the `isDirty` flag to a correct state after a read is performed.

The connection to the NOTIFY signal is performed through the existing
`QQmlNotifier/Endpoint` infrastructure, which allows, between others, to
connect to signal emitted by a `QObject`, and should be more performant
than a naked connection.
Similarly, a BINDABLE is subscribed to by using its usual interface.

A new callback was added to be used by `ReferenceObject` to allow
setting the `isDirty` flag on the signal emission.

`ReferenceObject` will now store a `QQmlNotifierEndpoint` or a
`QPropertyNotifier`, that will take care of listening to upstream
changes and set the dirty flag as required.

A few bug-provening test cases where added to `tst_qqmllanguage` to test
that the number of unnecessary reads was indeed reduced.
Additional test cases were added to inspect certain aspects of the new
implementation to ensure that it works in certain common or edge cases.

The internal documentation for `ReferenceObject` was modified to mention
this new behavior.

Fixes: QTBUG-118847
Fixes: QTBUG-127322
Change-Id: Id62979ae4e03910e1165c293837e5d884727dddc
Reviewed-by: Ulf Hermann &lt;ulf.hermann@qt.io&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>QtQml: Unify detaching behavior for all reference objects</title>
<updated>2024-10-24T18:27:03+00:00</updated>
<author>
<name>Ulf Hermann</name>
<email>ulf.hermann@qt.io</email>
</author>
<published>2024-10-18T10:09:19+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=35630eef3d384c29c567566e5643123f58615dfe'/>
<id>35630eef3d384c29c567566e5643123f58615dfe</id>
<content type='text'>
All reference objects should be detached when written to a property of
a QML-defined type. This is in line with what happens if you write the
same object to a property of a C++-defined type and doing anything else
makes very little sense.

In particular, before this change, the behavior differed between
ahead-of-time compiled code and interpreted code, between writing to
"var" properties and writing to typed properties, and between different
kinds of lists. Now everything we recognize as reference object always
gets detached when writing to a property.

[ChangeLog][QtQml][Important Behavior Changes] Writing a list or value
type to a QML-declared property now always detaches this same list or
value from any locals or other properties you may have read it from.
Therefore, subsequent changes to its "source" will not affect it
anymore. This is in line with what we do to C++-declared properties.

Fixes: QTBUG-127957
Change-Id: Icdf188ef29d28e5d3aaa8219cc003e07e8813f38
Reviewed-by: Olivier De Cannière &lt;olivier.decanniere@qt.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
All reference objects should be detached when written to a property of
a QML-defined type. This is in line with what happens if you write the
same object to a property of a C++-defined type and doing anything else
makes very little sense.

In particular, before this change, the behavior differed between
ahead-of-time compiled code and interpreted code, between writing to
"var" properties and writing to typed properties, and between different
kinds of lists. Now everything we recognize as reference object always
gets detached when writing to a property.

[ChangeLog][QtQml][Important Behavior Changes] Writing a list or value
type to a QML-declared property now always detaches this same list or
value from any locals or other properties you may have read it from.
Therefore, subsequent changes to its "source" will not affect it
anymore. This is in line with what we do to C++-declared properties.

Fixes: QTBUG-127957
Change-Id: Icdf188ef29d28e5d3aaa8219cc003e07e8813f38
Reviewed-by: Olivier De Cannière &lt;olivier.decanniere@qt.io&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>V4: Slim down FunctionObject</title>
<updated>2024-05-14T12:16:57+00:00</updated>
<author>
<name>Ulf Hermann</name>
<email>ulf.hermann@qt.io</email>
</author>
<published>2024-04-30T09:55:01+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=8b6a9403bf2e04d34b9b07d2780186029fab99d0'/>
<id>8b6a9403bf2e04d34b9b07d2780186029fab99d0</id>
<content type='text'>
Most FunctionObjects do not actually need their custom jsCall members.
They will only call the functions from the vtable anyway. FunctionObject
can therefore be split into a static and a dynamic variant. Only the
dyanmic variant needs to carry (and invoke) the extra pointer. The
jsCallWithMetaTypes pointer is completely pointless because none of the
dynamic functions actually implement it.

Furthermore, the QV4::Function and QV4::ExecutionContext pointers in
FunctionObject are only needed by actual JavaScript functions. The
builtins that like to be dynamic functions never need them. Therefore,
split out another class for this.

In the generic FunctionObject, we need the capability to decide at run
time whether the function shall be a constructor or not. Add a flag to
replace the check for jsCallAsConstructor.

Also, where we can, avoid the pessimization of checking whether a
function is a constructor before trying to call it as constructor.
Rather have the default implementation throw the exception.

As a side effect, for most functions we don't need an ExecutionContext
anymore. The engine is enough.

Task-number: QTBUG-124662
Change-Id: Iac657fa71288dd6ec230a33de2986ba3bcf4628c
Reviewed-by: Fabian Kosmale &lt;fabian.kosmale@qt.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Most FunctionObjects do not actually need their custom jsCall members.
They will only call the functions from the vtable anyway. FunctionObject
can therefore be split into a static and a dynamic variant. Only the
dyanmic variant needs to carry (and invoke) the extra pointer. The
jsCallWithMetaTypes pointer is completely pointless because none of the
dynamic functions actually implement it.

Furthermore, the QV4::Function and QV4::ExecutionContext pointers in
FunctionObject are only needed by actual JavaScript functions. The
builtins that like to be dynamic functions never need them. Therefore,
split out another class for this.

In the generic FunctionObject, we need the capability to decide at run
time whether the function shall be a constructor or not. Add a flag to
replace the check for jsCallAsConstructor.

Also, where we can, avoid the pessimization of checking whether a
function is a constructor before trying to call it as constructor.
Rather have the default implementation throw the exception.

As a side effect, for most functions we don't need an ExecutionContext
anymore. The engine is enough.

Task-number: QTBUG-124662
Change-Id: Iac657fa71288dd6ec230a33de2986ba3bcf4628c
Reviewed-by: Fabian Kosmale &lt;fabian.kosmale@qt.io&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove the use of Q_QML_PRIVATE_EXPORT</title>
<updated>2024-01-11T22:03:19+00:00</updated>
<author>
<name>Alexey Edelev</name>
<email>alexey.edelev@qt.io</email>
</author>
<published>2023-11-23T07:51:37+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=5c5a2c24847c636857153078e4716fcb242f394d'/>
<id>5c5a2c24847c636857153078e4716fcb242f394d</id>
<content type='text'>
Task-number: QTBUG-117983
Change-Id: I5790f01d614cd70c7fcc9bd817ec6ace3f3e3730
Reviewed-by: Ulf Hermann &lt;ulf.hermann@qt.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Task-number: QTBUG-117983
Change-Id: I5790f01d614cd70c7fcc9bd817ec6ace3f3e3730
Reviewed-by: Ulf Hermann &lt;ulf.hermann@qt.io&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>QmlCompiler: Allow coercing date values to numbers</title>
<updated>2023-08-25T18:36:37+00:00</updated>
<author>
<name>Ulf Hermann</name>
<email>ulf.hermann@qt.io</email>
</author>
<published>2023-08-24T11:48:18+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=555125416eb1a12e15dddb57207ce7d87751a64b'/>
<id>555125416eb1a12e15dddb57207ce7d87751a64b</id>
<content type='text'>
This is the equivalent of JavaScript's valueOf().

Change-Id: If850519d6dbc7354b447acb6aad8ac04211d059d
Reviewed-by: Fabian Kosmale &lt;fabian.kosmale@qt.io&gt;
Reviewed-by: Sami Shalayel &lt;sami.shalayel@qt.io&gt;
Reviewed-by: Olivier De Cannière &lt;olivier.decanniere@qt.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is the equivalent of JavaScript's valueOf().

Change-Id: If850519d6dbc7354b447acb6aad8ac04211d059d
Reviewed-by: Fabian Kosmale &lt;fabian.kosmale@qt.io&gt;
Reviewed-by: Sami Shalayel &lt;sami.shalayel@qt.io&gt;
Reviewed-by: Olivier De Cannière &lt;olivier.decanniere@qt.io&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>QmlCompiler: Allow construction of Date objects</title>
<updated>2023-08-18T12:26:04+00:00</updated>
<author>
<name>Ulf Hermann</name>
<email>ulf.hermann@qt.io</email>
</author>
<published>2023-07-27T13:10:31+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=0f23346d2a660404d40d02a2d101eb4fc21c8b02'/>
<id>0f23346d2a660404d40d02a2d101eb4fc21c8b02</id>
<content type='text'>
We map Date to QDateTime and special-case its constructors.

Task-number: QTBUG-111624
Change-Id: I0496f853613da3ccee9b6f6c4cf0adffa064f9f8
Reviewed-by: Fabian Kosmale &lt;fabian.kosmale@qt.io&gt;
Reviewed-by: Qt CI Bot &lt;qt_ci_bot@qt-project.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We map Date to QDateTime and special-case its constructors.

Task-number: QTBUG-111624
Change-Id: I0496f853613da3ccee9b6f6c4cf0adffa064f9f8
Reviewed-by: Fabian Kosmale &lt;fabian.kosmale@qt.io&gt;
Reviewed-by: Qt CI Bot &lt;qt_ci_bot@qt-project.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>QML: Add more overloads to Qt.format{Date|Time|DateTime}()</title>
<updated>2023-01-17T20:58:32+00:00</updated>
<author>
<name>Ulf Hermann</name>
<email>ulf.hermann@qt.io</email>
</author>
<published>2023-01-12T09:04:49+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=5bc63de8819448e7342f3cb0ac08af667ccc81e5'/>
<id>5bc63de8819448e7342f3cb0ac08af667ccc81e5</id>
<content type='text'>
Since JavaScript has no concept of time or date separate from the Date
object that contains both, and since we implicitly (via
QVariant::convert) or explicitly accept string arguments to all these
methods, we should really accept string coercions of Date objects.

We should also make all the string overloads explicit. Converting
strings to QDateTime is a really obscure feature of the metatype system.
We should not rely on it.

Furthermore, we need to accept QDateTime, as the native representation
of the JavaScript Date object, as argument to formatDate() and
formatTime(). Otherwise there are two ambiguous paths to calling
formatTime() or formatDate() using a Date object: Either coerce the Date
into a string and call the string overload or coerce it into a QTime or
QDate and call the QTime or QDate overload. The QML engine special cases
this and prefers the QTime/QDate way, but this just needlessly
complicates the overload resolution.

Interestingly, tst_qqmlqt already tests most of those variants. We just
have to add the JS string coercions.

Task-number: QTBUG-109380
Change-Id: I880e622256fe115dade32bde880605df2031ff2f
Reviewed-by: Fabian Kosmale &lt;fabian.kosmale@qt.io&gt;
Reviewed-by: Sami Shalayel &lt;sami.shalayel@qt.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since JavaScript has no concept of time or date separate from the Date
object that contains both, and since we implicitly (via
QVariant::convert) or explicitly accept string arguments to all these
methods, we should really accept string coercions of Date objects.

We should also make all the string overloads explicit. Converting
strings to QDateTime is a really obscure feature of the metatype system.
We should not rely on it.

Furthermore, we need to accept QDateTime, as the native representation
of the JavaScript Date object, as argument to formatDate() and
formatTime(). Otherwise there are two ambiguous paths to calling
formatTime() or formatDate() using a Date object: Either coerce the Date
into a string and call the string overload or coerce it into a QTime or
QDate and call the QTime or QDate overload. The QML engine special cases
this and prefers the QTime/QDate way, but this just needlessly
complicates the overload resolution.

Interestingly, tst_qqmlqt already tests most of those variants. We just
have to add the JS string coercions.

Task-number: QTBUG-109380
Change-Id: I880e622256fe115dade32bde880605df2031ff2f
Reviewed-by: Fabian Kosmale &lt;fabian.kosmale@qt.io&gt;
Reviewed-by: Sami Shalayel &lt;sami.shalayel@qt.io&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>V4: Unify type conversions for date and time values</title>
<updated>2023-01-17T20:58:32+00:00</updated>
<author>
<name>Ulf Hermann</name>
<email>ulf.hermann@qt.io</email>
</author>
<published>2023-01-12T09:03:14+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=330c3e91eeed631e084b68454c3fbc248a1b4bb1'/>
<id>330c3e91eeed631e084b68454c3fbc248a1b4bb1</id>
<content type='text'>
We should always use the same conversion to string and we shouldn't
duplicate the code for the date conversion.

Task-number: QTBUG-109380
Change-Id: I1b1959c8e9b5957ddcf287d252b8143511237565
Reviewed-by: Fabian Kosmale &lt;fabian.kosmale@qt.io&gt;
Reviewed-by: Sami Shalayel &lt;sami.shalayel@qt.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We should always use the same conversion to string and we shouldn't
duplicate the code for the date conversion.

Task-number: QTBUG-109380
Change-Id: I1b1959c8e9b5957ddcf287d252b8143511237565
Reviewed-by: Fabian Kosmale &lt;fabian.kosmale@qt.io&gt;
Reviewed-by: Sami Shalayel &lt;sami.shalayel@qt.io&gt;
</pre>
</div>
</content>
</entry>
</feed>
