We only need it when generating CallData, or when filling in any
thisObject or arguments that weren't provided. Provide a constructor
that expects thisObject and arguments to be pre-allocated and one that
allocates them in a scope passed as argument.
Change-Id: Iddfba63f4dbc5b09e2b33fb22a94eea88f515902
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Now when the XmlListModel is again a part of Qt, we can reintroduce the
section describing it to the models documentation page.
Task-number: QTBUG-89817
Change-Id: I8937fa30da26209fe3672dad86d094b139dab6c5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
In any case an empty QTextLine should not be used. Q_ASSERT doesn't help
in non-debug build.
Change-Id: I10b7895bc9b4cfd061aea086f810a9f8bf6d301a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Those are not only foreign types, but also extension types which add
additional properties. Thus we also need to mark them as QML_EXTENDED.
Pick-to: 6.1
Change-Id: I7a0469f7760887318a2b34bc5fcb85f011c0b0bf
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Bindings are allowed to toggle between a defined state, and undefined
which calls the property's reset function. Calls to the reset function
must not remove the binding, even when they write to the property.
To support this, we put the binding in a special undefined state, in
which it is still active (and installed on the property), but does not
actually provide its evaluated value to the property. Then, when the
binding later becomes defined again, the binding leaves its undefined
state and works normally again.
Notes:
- Calling the reset function during binding evaluation could have all
kinds of unwelcome side-effects. We therefore have to suspend binding
evaluation before the reset call (and restore that state afterwards).
- QObjectCompatProperty expects that we write the current value into the
propertyDataPtr. If we do not do this, it will overwrite the current
value with the default constructed value of its property. Arguably, we
should change the API so that we communicate that nothing has changed;
but for now, we have to live with that limitation and read the
current value and write it back again.
- We currently do not handle the case correctly where a non-resettable
property implemented via QObjectCompatProperty gets assigned undefined
in a binding. Such a binding is likely unintentional (as the undefined
assignment only creates a warning), and thus less of a priority.
Nevertheless, a test marked with QEXPECT_FAIL is added for it.
Fixes: QTBUG-91001
Change-Id: I7ecaa6c8dc1a1f1b33e67b1af65f552c4ca6ffb1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Not sure what the XXX TODO was for, but maybe some error checking...
This infinite recursion seems to happen in some pathological case, but
not normally, of course.
Change-Id: I6ad56e4b3002d151b2e6007669c46f0507d7f0e0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
We can observe the following:
- m_arguments stores information about method arguments, mostly their
names and types. This information is only relevant for methods.
- m_staticMetaCallFunction is used to optimize reads from and writes to
properties. It is never used for functions.
As the pointers are never used at the same time, we can thus put them
into a union, reducing the size of QQmlPropertyData by up to 20%.
Change-Id: I1f7c651fae429d4e2d1cffa62f84311ad9abadf8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Mark plugin as optional and move out initialization code as to allow use with
the QML compiler.
Change-Id: Id2c88c1c1c33d1053606d459059e7908baf2ddf7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This was added to qtbase in 9d23aeb.
Qt Quick Dialogs needs it to display file sizes in FileDialog.
[ChangeLog][QML][Locale] Added formattedDataSize() for formatting
quantities of bytes as kB, MB, GB etc.
Fixes: QTBUG-91283
Change-Id: I8ea64f961c04d4900d18fa45398670df89882c56
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
We can cache the QQmlContextWrapper rather than retrieving it twice.
Inline some things, and do not unnecessarily create and destroy ref
pointers.
Change-Id: Ife0980f83b7efe1ea9dc56aacbfbccd029ce77c8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We almost never need to construct a QVariant to do this. Constructing a
QVariant is excessively expensive if you have something simple like an
integer. This also fixes the unexpected "unwrapping" of variants when we
pass them through QJSValue.
[ChangeLog][QtQml][Important Behavior Changes] If you create a QJSValue
from a nested QVariant (that is, a QVariant containing another
QVariant), then, when retrieving its contents again, the outer variant
is not unwrapped anymore. Rather, you get exactly the value you've
passed in.
Change-Id: I8c16eed4f13e8cfdeced0756eef593b3b8e84dd1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
qmlscene will be removed in favor of qml in the future.
[ChangeLog][QML][Important Behavior Changes] qmlscene is deprecated, please use qml instead
Task-number: QTBUG-53557
Task-number: QTBUG-53219
Task-number: QTBUG-65862
Change-Id: Ia295cdf0749ce79f6523dabebd43f0168e81c1f0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
In qt6_add_qml_module we know that we are going to put all the QML files
listed in the generated qmldir into the resource path. We can thus
safely point the QML engine there.
This reveals that QtTest's plugin is actually not optional. It does
contain the compiled QML code.
Change-Id: Ia20f98c481482a851558c7ebeb39c9c365355d0a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
qmlimportscanner will now relay information about whether or not a plugin is optional.
Tooling will need to be adapted to take advantage of this.
Fixes: QTBUG-91087
Change-Id: I3f4097ce797c02d9018f98f4e57453179e4f8fec
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
A linter should not return zero if it has found problems.
Change-Id: If949c5b01cd9c617d760c2c72cc7bfe29f3d3f95
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It's just another type-switching function, needed in QtQuick3D now.
Change-Id: I6ecc6d82177368556cbab1b3fd038ce325f39496
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Let HoverHandler listen for HoverLeave events, so that we can explicitly
tell it to leave its hovering state from the outside.
The new function gets used in a follow up patch.
Change-Id: Ieaaeb7dc4e4afc96bb60c7abfd34f2c2c09bef47
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
fuzzyCompare() messed up the arguments and compared the first color
argument with itself (ignoring the second color).
Fixes: QTBUG-91694
Pick-to: 5.15 6.0 6.1
Change-Id: I86453c937e27a2112f8375b144ca21a9d088f017
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Previously parsing qmltypes with qml would fail due to this.
Change-Id: Ib5498eb75cbb6873cc5d4e8c798baefa1204bd8a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Connections could accumulate. Because the newest one was invoked
last due to how signal-slot invocations are ordered, rendering
was correct, but the stale connections caused unnecessary updates
(and wasted a small amount of memory).
This comes from a misunderstanding I had at the time about how
QMetaObject::Connection works. Destroying or overwriting one does
not affect the actual connection.
While at it, also modernize the connect().
Pick-to: 5.15 6.0 6.1
Change-Id: Idde81bdbff8947ed517bf2740d623a395c0acb74
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
It is already set to nullptr in qobject.cpp (until its removal there,
which this patch prepares).
Amends 86e9e61cad.
Change-Id: I13e293030e8e734a1015cc98572abbbbc44a573f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
The QtQuick examples should ideally have a more native look and feel.
Making them use controls from QtQuickControl will cause them to adapt to
the desktop style.
This patch replaces the previous Sliders from the 'shared' directory,
with Sliders from QtQuickControls2
Task-number: QTBUG-90880
Change-Id: I90521abf7059950521bc3d1a54994d2cca07259d
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
XmlListModel was previously a part of QtXmlPatterns, which would not
be a part of Qt 6. The idea of this commit is to move a simplified
version of XmlListModel to QtDeclarative, so that it could be used
at least in the examples of different Qt modules.
Unlike the old implementation, this version does not have an XPath
support. This results in a reduced feature set - the user can't
build complicated XPath queries to populate model roles.
Now the user can select an xml element and, optionally, an
attribute, which will be used to extract the data.
[ChangeLog][XmlListModel] Introduce an XmlListModel QML model to
create read-only models from XML data.
This is a simplified version of a model from QtXmlPatterns, which
would no longer be a part of Qt 6. This model supports only simple
slash-separated paths and, optionally, one attribute for each
element.
Task-number: QTBUG-89817
Change-Id: I4186587dc1445dd981ac92b4ce104434236a32b9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
If OUTPUT_DIRECTORY is set, all the QML files, as well as the qmldir and
the plugin should end up in that directory. We should not confuse that
with the install directory, which is separate.
For qt_internal_add_qml_module(), we can provide the defaults for both
OUTPUT_DIRECTORY and INSTALL_DIRECTORY. For the latter, don't support
a separate INSTALL_LOCATION keyword, only use INSTALL_DIRECTORY.
With these changes, qtbase no longer has to contain qml-specific
logic for these paths in QtPluginHelpers.cmake.
Refactor the way arguments are collected and passed through to the
internal call to qt6_add_qml_module(). This simplifies the code and
also exposed that QML_FILES was not being identified as an allowed
argument, TYPEINFO was the wrong type of argument and DO_NOT_INSTALL
was not a valid argument (or at least was ignored).
The qt_internal_add_module() function was also duplicating logic that
was largely already implemented by qt6_add_qml_module(). Rework
things a little to remove that duplication.
Task-number: QTBUG-88763
Pick-to: 6.1
Change-Id: I629ff63a9f8302c79694970f7b8e664a2b5d587b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
In contrast to other QPropertyBindings, QQmlPropertyBinding could be
executed even if it is not installed on a property. This would happen if
we keep a strong reference to it, remove it from a property, and change
one of the observed JS dependencies. That would lead to a call of
expressionChanged, and then subsequently to an evaluate call. As setting
and removing the binding from a property can be done purely in C++, we
cannot detect this in the engine (which would allow us to disable the
binding, so that expressionChanged does not get called). Thus, we simply
check if the property data pointer is set when expressionChanged is
called, and return otherwise.
Task-number: QTBUG-89505
Change-Id: I933c1b3285d6472b1d2c6512ad37911090861298
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
If a "component" has a lower case name it's not a component and there
is no point in listing it in the qmldir.
Change-Id: I38c91b9206342184a8c3e55b20d732b40ce6d7c2
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
We only discern imports if they live in different directories. Versions
are not handled, yet. If we add support for versions, the versioning
should be applied on processImport().
Done-with: Ulf Hermann <ulf.hermann@qt.io>
Change-Id: I2243452457e76a91042d1556edc5d36826560758
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
When a UNC path is used to locate the qmldir then when it is checked
later on the original path will be compared against the one that QUrl
returns. However, QUrl will convert the case of the host name to be
all lower-case whereas the original string may have been in upper-case.
For example, QUrl::fromLocalFile("//QT-L-R90X9VHB/tasks").toString()
will output "file://qt-l-r90x9vhb/tasks".
So in this case, the absoluteFilePath is changed at this point so that
it will match what QUrl has for the same path to avoid a problem with
it no being found.
Pick-to: 6.1 6.0 5.15
Change-Id: I2cd5d74bfec06c01635f80574ac1a6d479792855
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Implement the check for default properties
Default aliases are not included in this patch
[ChangeLog][QML][qmllint] Add support for default properties
Change-Id: I2d0330e32c1f49c83d3a4ed602250b6bfd4ec674
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Now we intend to always send pre-accepted hover events,
for consistency with event delivery in the rest of Qt.
This is mostly done as a preparation for later patches.
Change-Id: I5833b5ed9971057ace272a7bfc390fd336cc2e7d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This is the pattern we follow elsewhere in Qt - the event starts
out as accepted, and stays that way if it ends up being delivered
to an overridden event handler. Otherwise the default handler
will reject it.
This change doesn't affect any of the pointerhandler auto tests.
This change is mostly a preparation for a later patch, which
relies on this standard behavior.
Change-Id: I158c828e958b5c1943ecd552a9594d24a3aaa90b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Make qmllint warn about @Deprecated {} annotations.
Also adds support for annotations in qmlcompiler.
[ChangeLog][QML][qmllint] Add support for deprecation annotations.
Task-number: QTBUG-84895
Change-Id: Ia506a6c0077a2b9ab3bf4fdac207bd0540635b30
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Previously HeapObject::GeneratorObject utilized a ValueArray member to store stack information.
As we rely on all HeapObject members to have a constant size in order for QV4Table::inlinePropertyOffset
to remain accurate, this lead to a memory conflict when a user defined his own property on the Generator.
Please do not use ValueArray for any types that are user accessible or that you intend to add properties to.
Now the stack information is stored into ArrayObjects instead which circumvents the issue.
Fixes: QTBUG-91491
Pick-to: 5.15 6.0 6.1
Change-Id: Id6f638bf36a3ae3c9320ac99e67214c48dc81226
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>