| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
If we already know the property cache and data we don't have to look
them up again in captureProperty(). Such lookups can be expensive.
Change-Id: I94553260311912c5acee3105295f124721203e01
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Besides API changes, we need to
- adjust QQmlBind to unlink the binding properly (that probably was
broken already before, but did not cause issues so far, as the old
binding would not have been evaluated without a read access) and
- skip tests in tst_qmlcompiler_manual, as the bindings are executed
before the engine is correctly set.
Change-Id: I97b0ac32b428c1a033664fe8593effadb69cd348
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
| |
We only ever need it to retrieve the QQmlEngine. However, resolving the
context can involve an allocation.
Change-Id: I064fd528fa7ab9bd37043c5dd1c62d17ea9380e3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
Amends ca06d488f3c5d899c008b431f6939793813243cb. count was already
documented.
Pick-to: 6.1
Change-Id: I2f79d132f29ae03f03dd7204ea09e4841971d650
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
nameForObject() should not search the linked contexts. Linked contexts
are not reachable from the "head" context in QML. However, it should
search context objects, just like contextProperty() does.
[ChangeLog][QtQml][Important Behavior Changes]
QQmlContext::nameForObject() now finds properties of context objects,
but it does not search unrelated other ("linked") contexts anymore.
Change-Id: Ic6e01fddf3e2d4b3a1bc7308e126f47fae7cd6d1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
This is the reverse of nameForObject(). We don't need to wrap id'd
objects in QVariant just to unwrap them again at the call site.
Change-Id: Ie1c5382af33b5c05b0b931fcc5bcf8d232d27c21
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
Most of this can be inline, and we never need to copy the actual
identifier hash.
Change-Id: I6468b6b1a571e4854c00c865a2aa57c3b2f0ca8c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
| |
Change-Id: Ia97aefc3dbedae1e979db93638836b366eee153f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
The inline components do not hold a strong reference to their outer type
because that would be a reference cycle.
Fixes: QTBUG-92236
Pick-to: 5.15 6.0 6.1
Change-Id: I6d76a114352653210f0ece6c198cf761d3b4eda1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
During instantiation of a component, we might need access to the
meta-objects of its referenced objects in the QQmlPropertyCacheCreator.
In the case of inline components, those might have however not been
complete: If they contained alias properties (which change the shape of
the metaobject), we would not be aware of it, as those are only resolved
when QQmlComponentAndAliasResolver has run.
QQmlComponentAndAliasResolver runs however necessarily after the
QQmlPropertyCacheCreator, as the alias resolver needs the metaobject to
know about the non-alias properties.
We fix this by restructuring the passes, so that we first run both
passes for each inline component, and only afterwards for the component
containing them. This is done by making QQmlPropertyCacheCreator
resumable: resumableBuildMetaObjects processes one (inline) component at
a time, and remembers enough state to continue.
Fixes: QTBUG-91143
Fixes: QTBUG-85980
Change-Id: Ib0d0bc5ff6cf067b2443b2e0cfb5400a9bd96754
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
| |
There is no dependency between them. This is done in preparation of a
restructuring of the PropertyCacheCreator and AliasAndComponentResolver
passes.
Change-Id: I2695435ca9b2aed5c4c34c281cd1611f5373e3f8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
| |
We cannot just do a straight cast in this case. The floor()/ceil()
toInteger() does actually has no effect if the value overflows. We need
to do a full JavaScript coercion in order to be safe.
Change-Id: I122974de5f0b9bdba9133b8503e328c4f7185934
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
We don't have to do any argument conversion if there are no arguments.
Furthermore, we don't need to do the metatype-to-JS conversion if the
handler to be invoked is AOT-compiled.
Change-Id: I03d8fd7ad07d311d64c39adfd39febbe94396d2f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
90be89d771425044a84e9e79e4e668e065acc825 changed the connection logic to
actually pass the receiver to connect in order to fix disconnect
cleanup. However, we omitted to change QObjectSlotDispatcher::impl
accordingly. The previous logic was:
- store the index of the signal in signalIndex
- In impl, in the call case, we would get passed the emitting object
(sic!) as the receiver parameter. Then we would use the object and the
signal index to obtain the QMetaMethod.
- From the QMetaMethod, we could get the signal's number of parameters.
After the aforementioned change, that does not work anymore: The
receiver is now the actual receiver of the signal, thus we get the wrong
method, and potentially the wrong number of parameters.
To fix this, we now store the complete QMetaMethod of the signal.
Pick-to: 6.1
Change-Id: I868c51edf24a61d14eaf958ed7942da27f54a5c3
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
| |
Change-Id: I5123f72fea4198505c27678dbaaea26313b2327c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
For now, this simply gives us a more lightweight header than qqml.h. In
the future, we could move this completely out of QML, to ease optional
QML integration in libraries that do not want to directly depend on
QtQml.
Task-number: QTBUG-92258
Change-Id: I3583ce85905ed8fa0a45abb360728178c774d679
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The method already returns a bool status which tells the caller
"something is wrong". If something is wrong, the caller will try a
different method to retrieve the value, and that will generate the
exception again. We should not shortcut the procedure as generating the
exception requires the instruction pointer to be set, which is
additional overhead on the caller's side.
Change-Id: Ia2d3a90c897b14660a18a5740498a0e5016dc49a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
Those were never exposed anyway. color, date, etc. are handled by the
less generic converters in qqmlstringconverters_p.h.
Change-Id: I43a94acda08344de742440dd3b956a7077096b11
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
And make sure that we notice that at compile time the next time it
happens.
Change-Id: I552481e0f9f7178ec3f1450d8050ae9434894e5a
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
In most cases the AOT compiled function will successfully placement-new
the return value. Therefore, we can provide uninitialized space. Only do
the construct/destruct dance in the cases when it's already slow.
Change-Id: Ia339774fde03e459f290f167ddadd1c47a644b8e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
| |
We don't need to convert the results of calling binding functions back
and forth.
Change-Id: Icb997532ebc3092f3e3882a804173346b450e435
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
Getting a property of an object and getting an object by ID should not
require any type transformations.
Change-Id: I7ba06cf7c09cdf4ce7b0093b670fd7879ecf799a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
This is useful when we know how to read the property directly.
Change-Id: Ibc314a8e8bf9e51b3a15d934f6a1f17a53ea168a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
This way, we can avoid the costly id to metatype lookup in case where we
actually need the full metatype.
Task-number: QTBUG-88766
Change-Id: Ibe29b323007f00d2f8d1807fb9b64f9a8f87e807
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
| |
Change-Id: I90710aaef3405f377df082af781593a58e069c02
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
| |
In the good case this is just reading a few members of the relevant
classes. No need to call functions for this.
Change-Id: I9908cd6437cf9a1ca840f9aa0e524d3976272d67
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
Calling anything without a stack frame is dangerous. The execution of
the AOT function might call further functions that eventually query the
current context of the engine, for example.
Change-Id: I5a96efc7819bda56ba084a7057a7808b6ce02091
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
| |
Pick-to: 6.1
Change-Id: Ief7dbd8a2ab870dccdc62f99573987329f91dfb1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
We need to be able to retrieve QQmlListReference and attached objects
from QJSValues.
Change-Id: I39679317da4066b054e86f767fc5f723ead2b2e7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When called via the metaobject system, parameters and return values are
passed as void*, with accompanying type information in the form of
QMetaType. The same format is expected when calling an AOT
compiled function.
Previously, we would first convert all the parameters to QV4::Value,
just to convert them back the moment we notice that there is an AOT
compiled function. This is wasteful.
This change provides a second call infrastructure that accepts void* and
QMetaType as parameter and return value format, and passes them as-is
all the way to any AOT compiled functions. If there is no AOT compiled
function, the conversion is done when detecting this, rather than when
initiating the call. This also passes the information "ignore return
value" all the way down to the actual function call. If the caller is
not interested in the return value, we don't have to marshal it back at
all.
For now, we only add the extra "callWithMetaTypes" vtable entry to
ArrowFunction. However, other callables could also receive variants
optimized for calling with void*/int rather than V4 values.
This required changing the way how function arguments are stored in the
property cache. We squeeze the return type into
QQmlPropertyCacheMethodArguments now, and we use QMetaType instead of
integers. In turn, we remove some unused bits.
Change-Id: I946e603e623d9d985c54d3a15f6f4b7c7b7d8c60
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
This is based on QJSValue for now, but can be extended to operate on
QMetaType/void* later.
Change-Id: Ic63d4c9081090998afcca63ff3253963ff5096a2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of using a hashmap which maps a QML lists metatype to its list
element's metatype, we can just store a pointer in the list metatype to
the element metatype.
Moreover, listType now returns a metatype. This is a preparation for
converting
enginePriv->rawMetaObjectForType(typeId)
to
metaType.metaObject()
calls once we can actually retrieve the metaobject from QML metatypes.
The QML metatype interface classes are moved into a header, so that Qt
for Python can use the same classes.
This does not affect types registered from C++, as those use a different
mechanism.
Task-number: QTBUG-88766
Task-number: QTBUG-82931
Task-number: QTBUG-87134
Change-Id: I330c2bbe4ac92072a333c001750f7504b56df478
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
| |
...and add an explanation why this must be the case. Silences analyser
warning 1c8842d5d3.
Change-Id: I77825c3037bc6b82fbc1e61e31344d1cdf5a0b5a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
The calculation is expensive and only needed when inserting elements.
Realize that QQmlMetaType::listType() can never return -1 and remove the
respective early abort conditions. Furthermore, guard against nullptr
element types when inserting. Those would otherwise crash in
canConvert().
Change-Id: Ifaa9d7df1bf8ac372074d25554ec02944d3e3bff
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
| |
This way we provide the same interface as QSequentialIterable for the
number of elements in the list.
Change-Id: Ib95a9db8178b591e5f423bb25c5c97f278bd8e48
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
| |
Some were superfluous, others were missing.
Change-Id: I6bf3057f97ab3453d735cb7b90da945b8f6b993c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
| |
Change-Id: Ie29baf584629193234ab07db63ed97ee656634f5
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We either have pre-populated arguments and thisObject, then we can just
use them and keep them const. Or, we want to allocate and populate the
arguments and the thisObject. Then, do allocate them in a separate
object, and transform that into JSCallData afterwards if necessary.
Furthermore, avoid alloc(0) as that just returns the current stack top.
Writing to it will clobber other data. Rather, just use nullptr and
crash if it's written to.
Also, remove the useless operator-> from JSCallData. That one just
confuses the reader.
Change-Id: I8310911fcfe005b05a07b78fcb3791d991a0c2ce
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 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>
|
|
|
|
|
|
|
|
|
|
| |
It is already set to nullptr in qobject.cpp (until its removal there,
which this patch prepares).
Amends 86e9e61cadd0f5bcdbd466eb21dfc363a1fedb6d.
Change-Id: I13e293030e8e734a1015cc98572abbbbc44a573f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
Those are all one-liners.
Change-Id: Ib7a14716e50b3350a5704d282e0a89d9147f3270
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
| |
Change-Id: I4022cf5acf63e2e2e9257acd1dd4439b85645faf
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
| |
All callers do have a metatype which they can query instead.
Task-number: QTBUG-82931
Change-Id: I2ff514354a43d677da963d4239333fc66a42df59
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
The only caller has a QMetaType available and can query that one. This
leads to subsequent cleanups in QQmlListAccessor::setList and
QQmlAdaptorModel::setModel which now no longer have a need to pass the
QQmlEngine along.
Task-number: QTBUG-82931
Change-Id: I6f38892a3a5098f07bc21f4eebcca82cf52a6838
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|