| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Task-number: QTBUG-117983
Change-Id: I5790f01d614cd70c7fcc9bd817ec6ace3f3e3730
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When calling QQmlBinding::evaluate(), we get a generic QVariant back,
and no conversions from the evaluation result to bool are done at that
point. Consequently, we would need to mirror the engines conversion from
arbitrary values to bool.
Doing that manually is rather fragile, so we instead use the QMetaType
based overload, which already takes care of the conversion. That
requires making the overload public.
As qmlsc is already using that overload from within evaluate, it was not
affected by the bug.
Fixes: QTBUG-108024
Pick-to: 6.2 6.4 6.5
Change-Id: I3d5ee8f886ea6ada44fc8182300f3472cb1efc3c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Drop unnecessary includes detected by clangd-iwyu.
Add new includes due to the transitive includes. Also, some of the
includes were detected as unused even if they were actually in use.
In those cases, use angular brackets instead of "" which deceives
the tool not to complain.
Affected subfolders: JsRuntime, Qml
Fixes: QTBUG-106473
Change-Id: I483da15d42a8e3ce6cd3b654909665fff3075d6b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To add translation bindings to qmltc, the methods used to create
translation bindings need to be adapted to work without
QV4::CompiledData::Binding as it is not available from qmltc. Instead,
information already available from the QQmlJSScope should be used, along
with a newly introduced helper class QQmlTranslation.
Details:
Add a QQmlTranslation class that represents a call to qsTr, qsTrId etc
that knows how to translate itself (without needing any
ExecutableCompilationUnit or Binding). It encapsulates the
information needed to create a translation binding.
ExecutableCompilationUnit::bindingValueAsString refactored
so its functionality can be used without Binding.
Instead, it uses only the translationId, see
ExecutableCompilationUnit::translateFromId
and
ExecutableCompilationUnit::translateFrom.
Refactored QQmlTranslationBinding to work with QQmlTranslation instead
of CompiledData::Binding.
Same for QQmlCppBinding::createTranslationBindingForBindable,
QQmlTranslationPropertyBinding::create and
QQmlCppBinding::createTranslationBindingForNonBindable.
Changed TranslationBindingInformation to work without
CompiledData::Binding, and also removed static unused
QString ProxyTranslator::originStringFromInformation(
const TranslationBindingInformation &translationBindingInformation)
as I could not find out what this origin string is.
Same for the translation debugging in qmldb_preview.
Added QmltcCodeGenerator::generate_createTranslationBindingOnProperty.
Added #if to avoid compilation error for standalone DOM compilation due
to the new QQmlTranslation class.
Task-number: QTBUG-105345
Change-Id: Iccd94d5cba4eaf63901233451fec48051c855c2a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch removes QQmlBindingBinding, as well as QQmlNonBindingBinding
as a standalone class. The functionality of QQmlNonBindingBinding is
merged into QQmlBinding.
QQmlBindingBinding was used to store a QML binding in a property;
the only user of it was Binding's when property, and that was removed in
Qt 5.14 already.
The big disadvantage of its approach was that it has zero type safety,
and interacts in weird ways with bindings created via Qt.binding; it
also does not integrate well with QProperty/C++ based bindings.
Lastly, it is completely untested.
As QQmlBinding is a private class, we can safely remove the whole
functionality, as there is no Qt internal user of it anymore.
Use cases which require the manipulation of the binding should instead
use a well-typed property, and then access the binding via the
QQmlAnyBinding or QQmlAbstractBinding API (compare Binding's when
property in Qt 6.2+).
Change-Id: I6de0c9987d371a04c7f78047bb34bf684b6a69f5
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.
Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
|
|
|
|
|
|
|
|
|
| |
Those should be more efficient and make your feet attract fewer
projectiles.
Fixes: QTBUG-103588
Change-Id: I8b25b9edb1edf5e112dbcba5bba898646d29ae2b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
| |
Instead of a bool we can just return an enum of the actual kind. This
way all the checks become more readable. Furthermore, we can eliminate a
dynamic_cast without sacrificing readability.
Change-Id: I8a38687f9b796cd47196a6ab0385624c737e4435
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
| |
You really should not mess with that after creating the property cache.
Change-Id: I070200772475bb67f539dbbd85a298020b14ca79
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
That's where the data resides. This allows us to lock the mutex only
once for all those methods, and it makes a large number of engine
pointers unnecessary.
Finally, we can now find the element type of a QQmlListProperty without
supplying an engine.
Change-Id: If1ae8eafe8762a112d1ca06f9c92ab8a727d1bda
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The method did not consider QProperty properties, as those do not show
up via the active guards mechanism.
At some point, we probably also want to introduce
QQmlAnyBinding::dependencies, as there are now bindings which do not
derive from QQmlBinding.
Pick-to: 6.2
Change-Id: Ib4b227a440e9494c09d92028f9eaa5ad1e87342f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
If a QQmlProperyBinding tries to capture a QProperty, there is nothing
to do as the dependency tracking happens in C++ anyway. Thus we can
avoid calling captureProperty.
Pick-to: 6.2
Change-Id: I96b2876d4b2ba10b00af8342be9beae660a95ef3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Similarly to create(), setTarget() also accepts QQmlPropertyData which
is a bit too much for the object creation compiler case. Providing
minimalistic API instead allows not to construct QQmlPropertyData when
QMetaProperty is available
Related to 06893b68c6b1f70cb7ff255db1fa9d14697403fa.
Change-Id: I9a54dbdf6b7cddeeda995558a2539254c26a9c6d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
QQmlBinding/QQmlPropertyBinding, created from QQmlPropertyData, really
only needed QMetaType (which is ideally always in sync with custom data
in QQmlPropertyData), so provide the versions that accept QMetaType
This way we don't need to care about QQmlPropertyData at all when we
know QMetaProperty, which is, for example, the case of object creation
compiler
Change-Id: Ia7794e5575b71ffaf111dd35b352da36598c631f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
|
|
| |
That's not uncommon at all, and we don't need to convert the value back
and forth for it. If we have a metatype/void* representation already, we
can just create a QVariant from that and forward it to
writeValueProperty(). Even the QVariant is unnecessary, but that will be
resolved in a second step.
Change-Id: Ideae979a73276c9fba1bc19c10d799b8fe59dde5
Reviewed-by: Fabian Kosmale <fabian.kosmale@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>
|
|
|
|
|
|
|
|
| |
The latter has the advantage of allowing the use of a real type for the
tag, instead of the generic flag/flag2 boolean accessors.
Change-Id: Icc9e854ce4af3eb5808a4bed45aa22f377e223da
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
| |
Remove unnecessary shadowing of function from base class.
Change-Id: I46539be359ae794e357930ac6f2287f5d14331d6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
We _can_ provide a default implementation for expressionIdentifier() -
it doesn't have to be located in QQmlBinding as it only uses fields from
QQmlJavaScriptExpression.
Change-Id: Ifcead72c4f3ed4597cde732afca466eba83f5e0d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This class is not a private detail of QQmlContext. And it is incredibly
hard to see who owns what in there. Let's add some civilization ...
We enforce refcounting for QQmlContextData across the code base, with
two exceptions:
1. QQmlContextPrivate may or may not own its QQmlContextData.
2. We may request a QQmlContextData owned by its parent QQmlContextData.
For these two cases we keep flags in QQmlContextData and when the
respective field (m_parent or m_publicContext) is reset, we release()
once.
Furthermore, QQmlContextData and QQmlGuardedContextData are moved to
their own files, in order to de-spaghettify qqmlcontext_p.h and
qqmlcontext.cpp.
When the QQmlEngine is deleted, any QQmlComponents drop their object
creators now, in order to release any context data held by those.
Before, the context data would be deleted, but the object creators would
retain the dangling pointer.
[ChangeLog][QML][Important Behavior Changes] QQmlContext::baseUrl() does
what the documentation says now: It prefers explicitly set baseUrls over
compilation unit URLs. Only if no baseUrl is set, the CU's URL is
returned. It used to prefer the CU's URL.
Change-Id: Ieeb5dcb07b45d891526191321386d5443b8f5738
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
|
|
|
|
| |
No one can read this mess.
Change-Id: Icec4f2afc466435c1ae5e4e80fa2c1b5baf7d087
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
We need a CompilationUnit that only holds the data needed for
compilation and another one that is executable by the runtime.
Change-Id: I704d859ba028576a18460f5e3a59f210f64535d3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
After the initial enabling of a binding we can quickly determine if
there is a chance whether this binding will be re-evaluated again in the
future as a consequence of dependency changes (properties or
translations). If that is not the case, then we can save memory by
removing that binding again.
One implementation consequence of this change is that such constant
bindings used with the "when" property of states require a proper
reference count increase, which was previously implicit through the
binding association with the target object.
In tst_qqmlecmascript a test that verifies that we don't create run-time
bindings for assignments of literal "null" to QObject pointer properties
now also covers the more complex case where we don't know the property
at parse time. We still evaluate the binding once though and perform one
property assignment.
Similarly on the QtQuick Designer Support API test side a binding such
as
x: Math.max(0, 200)
will not create a persistent binding anymore and needs a tweak to
remain.
On a large scale application this optimization saved up to 5% of all
bindings on start-up (~9000 of ~180000). On Linux x86-64 one binding is
approximately 144 bytes, so the savings are in the range of ~1.2 MB of
heap, as well as reduced fragmentation.
Task-number: QTBUG-64541
Change-Id: Id3653008346fdf36611f5b4c4e82f5f78b5319aa
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have a few places in the type loader where we do adventurous manual
reference counting, where getType() returns a raw pointer that has been
addref()'ed and then sometimes somehow we call release() later. Commit
0b394e30bba4f6bb7e6f7dbe5585a2e15aa0f21d is an example of where this can
easily go wrong. As a consequence and also in preparation for future
work on the type loader, this patch starts replacing the manual
reference counting there.
Changing the return type from QQmlTypeData *getType() to a
QQmlRefPointer<> itself is not sufficient though, as the implicit
operator T*() will still allow the caller to store the result as a raw
pointer. Therefore this patch removes the "unsafe" implicit extraction
operator.
As a result of that change, other types that are sometimes stored in
QQmlRefPointer are also affected and their usage needs to be adapted
to QQmlRefPointer usage or manual raw pointer extraction with .data().
Change-Id: I18fd40634047f13196a237f4e6766cbef3bfbea2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Calling Qt.binding() on a bound function object is a valid use
case and used to work until Qt 5.8.
The problem was that we optimized the code in QQmlBinding and
QQmlJavascriptExpression to directly work on a QV4::Function,
so this wouldn't work anymore.
To fix this make sure recursive calls to Function.bind() are
unrolled (so that the BoundFunction's target is never a bound
function itself), then add the bound function as an optional
member to the QQmlBinding and use it's bound arguments if
present.
Task-number: QTBUG-61927
Change-Id: I472214ddd82fc2a1212efd9b769861fc43d2ddaf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When an alias points to a child object which has not yet been
initialized, it's id won't have been registered yet, so setting up a
binding to it will result in a crash.
The fix is: when setting a binding target fails, and its target property
is an alias, queue them until all bindings have been set up, and try
again.
Task-number: QTBUG-57041
Change-Id: I4dc5a6d25c0a32fed9fd952c955e2006c76be45a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: If9e28d143f8cba3df3c757476b4f2265e2eb8b2a
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
|
|
|
|
|
| |
Change-Id: I176f91a8c51e81a2df3fe91733118261491223ee
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
Adds a method `dependencies()` to QQmlBinding, that returns a
QVector<QQmlProperty> of all properties the binding depends on. The API is
meant to be used in debugging tools (e.g. in GammaRay).
Also adds a public method subBindings() to QQmlValueTypeProxyBinding in
order to be able to access their dependencies.
Change-Id: Ib833703ec9e632661626c4532b8d73997f38e62b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Respond to the language change event by refreshing all binding
expressions. For constant string translation bindings we must now create
special QQmlBinding instances instead of a one-time property write
meta-call upon instantiation. Those however are more lightweight than an
entire JavaScript expression.
In addition this provides a slot to explicitly trigger a re-evaluation
of bindings, to make it a little easier to discover for the developer.
[ChangeLog][QtQml][QQmlEngine] Added retranslate() slot and
QEvent::LanguageChange support to refresh bindings when changing the
language at run-time.
Task-number: QTBUG-15602
Change-Id: Ide174648e1d8a5738acb88e15495018d0869d7bc
Reviewed-by: Michael Brasser <michael.brasser@live.com>
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp
src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp
src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp
src/qml/qml/qqmlimport.cpp
src/quick/items/context2d/qquickcontext2dtexture_p.h
tools/qmleasing/splineeditor.h
Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
|
| |
| |
| |
| |
| |
| |
| |
| | |
Like this we can remove the QQmlBinding::create() overload
that takes a FunctionObject.
Change-Id: Ib6c37395ded325e68cf0fbf3afd08fb6dd6efa3b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: Ia62d380945250015009d9c2b6ed65f6d830277ef
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| |
| |
| | |
This is what's in the Value in all cases anyway.
Change-Id: I212c4c4076050e8d0ea4cf6f72a1683e132cd51b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: Ie490f113b6fc48ea75eb5903a79dddb02faa7301
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: Ibcd277bc434638e5c6e8e9ccea634aa25cde1643
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|/
|
|
|
|
|
| |
These methods do not modify objects.
Change-Id: I67b1a10cfd0b32688500fca3265a96f53afd1b57
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
|
|
|
|
|
|
|
| |
Remove the QQmlBinding *binding argument as it is always the this
pointer.
Change-Id: I76ccf64a1d37ce32089c81f60466dce79b9fa5bf
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
| |
Change-Id: I2ae2fb0f18af9b866cc9482fd4f42d9d4269f8cb
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
This helps in making it clear when an index is a plain old number and
when it consists of an encoded value type index.
Change-Id: Ic50d95caf244ed0ee2d62bdba53910a371cfee04
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
In it we can cache the meta-type for the specific QObject subclass of
the property type. This reduces the number of calls to QMetaType.
Change-Id: Ie3774395c971bc33af58a8290453b19631939ea8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
| |
Pass property reads/writes through utility functions in QQmlProperty,
which in turn will try to use accessors when available (and no
interceptors have to be called).
Change-Id: I60ecfc202b6024bfe4a33206a46299787b152546
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Same idea as the read accessors, but with a slight difference: the
property setters do emit signals, so we can't do a direct property write
and have to call the setter. However, it does circumvent the meta-calls.
There is one gotcha: if a property is intercepted (e.g. by a Behavior),
we still have to do the meta-call in order to dispatch the write to the
interceptor.
According to valgrind, this saves 138 instructions on x86 for every
"accessible" property write.
Change-Id: I07dbac95613415559ffa1691734a5af7c84721fc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
When we can determine the type of a target property during type
compilation, we can skip a whole bunch of code that deals with
converting the result of a binding to the correct (target) type.
This removes 65 instructions on x86 for such typed bindings.
Change-Id: Id2c7c57b9ae6dfbeb921121beae9630604ca1d17
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
| |
Change-Id: I93bc5951d555f799bb956020433d3087504e8f9f
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
|
|
|
|
|
| |
Change-Id: Ifcfbd9810bc342ceaaa74f3b31c16001485516f6
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
|
|
|
|
|
|
|
|
|
|
|
| |
From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/
Updated license headers to use new LGPL header instead of LGPL21 one
(in those files which will be under LGPL v3)
Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
|
|
|
|
|
| |
Change-Id: I3ca148ae021ffc349b943231cc749828b0b7816c
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Refcounting our bindings greatly simplifies our memory management
of the objects and ensures we safely clean them all up. In addition,
it allows us to remove the m_mePtr and weak reference handling from
QQmlAbstractBinding as we can safely handle this through the same
mechanism.
Change-Id: If23ebc8be276096146952b0008b62018f5d57faf
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
|
|
|
|
|
|
|
|
| |
It's only called from there; this simplifies the code and will allow
some further optimizations.
Change-Id: I1f0befe620beaa0bbf961fc829881ef7b5c2e435
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
|