Commit Graph

20598 Commits

Author SHA1 Message Date
Li Xinwei e6e262da14 Use load(qt_tool) and qt_internal_add_tool for qmltime
The qmltime should be a tool, not a normal executable or an app.

Pick-to: 6.0 5.15 5.12
Change-Id: I64c76877907297a6a817ba5903786bcc7fba8fdd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-12-08 02:34:59 +08:00
Fabian Kosmale 1febf3da07 QSGTexture: fix unused warning
If the opengl feature is disabled, t is not used. This caused build
failures due to -Werror=unused-parameter

Change-Id: Ic39703dfb540d15295811484ad3793b639dc6b9c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-12-07 15:56:30 +01:00
Ulf Hermann 61a5860599 QJSValue: Add toVariant() overload with conversion behavior
The QJSValue to QVariant conversion is traditionally messy. The recent
addition of a special case for FunctionObject did not make that better.
Rather, we now add a way of specifying that the conversion should be
lossless, which avoids all conversions of JS objects and arrays.

Amends commit 6b08c24297.

Change-Id: I6d4506b52d3175ed2f2984f8a26d560cf6311ab6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-12-07 15:53:39 +01:00
Ulf Hermann e8596de70e Allow checking for and catching errors from QJSEngine
As you can manually throw an error, you should be able to catch it
again, too.

Change-Id: I82475df1969a1fd76f4cf5fc0a8d921dfafaef89
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-12-07 15:53:32 +01:00
Ulf Hermann c8d98dc206 Allow the QML console methods to be called from outside JS
There may not be a stack frame and that is OK.

Change-Id: Iccac4db1530c9a4b316905a3a283d36674c146a8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-12-07 15:53:21 +01:00
Shawn Rutledge 33c87736db Kill Flickable's wheel momentum if angleDeltas not multiples of 120
Wheel momentum is great on old "clicky" mouse wheels: they feel really
clunky without this feature.  But it's also terrible on most laptop
touchpads.  We still aren't generating QWheelEvents with pixel deltas
and ScrollPhase on most platforms (still only on macOS); but eventually
we should.  However, those laptop touchpads tend to generate angleDeltas
that are not multiples of 120.

Added logging categories qt.quick.flickable qt.quick.flickable.wheel
and qt.quick.flickable.velocity.

[ChangeLog][QtQuick][Flickable] Flickable now tries to detect whether
you're using a "clicky" wheel on a desktop mouse.  A laptop trackpad can
generate QWheelEvent::angleDelta values that are not multiples of 120;
in that case, smooth scrolling with momentum is disabled, to avoid
losing control of scrolling. Set the environment variable
QT_QUICK_FLICKABLE_WHEEL_MOMENTUM_ENABLED=0 to opt out of the old
behavior entirely, or set it to 1 to opt in unconditionally.

Pick-to: 6.0
Task-number: QTBUG-38570
Task-number: QTBUG-56075
Task-number: QTBUG-80720
Task-number: QTBUG-82565
Change-Id: I0da2d31259fa1c79ab217a3fa9e888893fc7b235
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-12-07 13:00:42 +01:00
Laszlo Agocs b0f49c8978 Avoid unused parameter in QSGRhiSupport in certain configs
Pick-to: 6.0
Fixes: QTBUG-88604
Change-Id: Id84faf648656993777f780e147917151ce05d3e0
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-12-07 11:31:12 +01:00
Qt Submodule Update Bot f9ed1ea3c3 Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: Iae9198ccd7354b526a654ad95c966d374e65b6a1
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2020-12-07 08:41:58 +02:00
Ulf Hermann d260e713bd QmlCompiler: Don't add imports with "as" to the context
That is wrong. The context does not contain such objects. Instead, mark
the names as namespaces in the imports by giving them an empty type.

Change-Id: Ie9d0bba592863878d2220cee59be369ba2534f17
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-12-05 21:48:48 +01:00
Qt Submodule Update Bot d297723fe6 Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: I7b59e4688531f8a53b29c854107176c4d8eaf889
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2020-12-05 12:54:03 +02:00
Shawn Rutledge dc3f7fc583 Pointer manual test: double up flickablesWithHandlers.qml
It was one Flickable before, with stuff in it; now it's two of the same,
side-by-side, so as to test flicking the two in parallel on a touchscreen.

Change-Id: Iec1ef935ee1c0a97bed49959b117b85d65fa84af
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-12-05 00:08:43 +01:00
Volker Hilsheimer 628af504fc Remove unused function
Pick-to: 6.0
Change-Id: I7ee5187b4e17f2aba2788adfb47325f7a7020d69
Reviewed-by: David Faure <david.faure@kdab.com>
2020-12-04 20:09:50 +01:00
Ulf Hermann f61271a9c5 V4: Add reset() method to the byte code handler
This is necessary if you want to parse the same byte code in multiple
passes.

Change-Id: I8d3e9739b7cb3682d0f1d26e675ead8b7ce66a93
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-12-04 13:19:43 +01:00
Volker Hilsheimer e070e571d1 Fix qdoc warning, document macro parameter
Pick-to: 6.0
Change-Id: I60c3d9cc34bc658d5317da951cc1975990f27a9b
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
2020-12-04 12:45:50 +01:00
Kai Koehne c8b108ca76 Document how to use CMake for Qt Quick
Task-number: QTBUG-73058
Pick-to: 6.0
Change-Id: Ie72c1f4331ad05f31d9a646730133c97c4b15790
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-12-04 12:38:32 +01:00
Maximilian Goldstein bad85119bf qv4qmlcontext: Fix bounded signal expressions when debugging
Fixes: QTBUG-83599
Pick-to: 5.15
Change-Id: I8909f0b2d3eca909512b99c172c8dc5e93e48482
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-12-04 12:38:32 +01:00
Qt Submodule Update Bot 432094f5f9 Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: I667b87bc0f5003243ef1c3c7fc4974cc71ff7611
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2020-12-04 10:16:25 +02:00
Qt Submodule Update Bot 594a0423b2 Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: If9ed952cedfd5461a9d179707cad77993ddccb18
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2020-12-04 05:26:20 +02:00
Qt Submodule Update Bot c7f3e3e1be Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: I1de2d86c85d3a12beb5195d10aed8e3f74003dee
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2020-12-04 01:18:56 +02:00
Fabian Kosmale 355ff60685 tst_qqmlecmascript: Avoid memory leak on failure
Pick-to: 6.0
Change-Id: Icf31fbe473e5b0659cfe09d5bef8652c22a2b1ce
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-12-03 21:46:29 +01:00
Fabian Kosmale 96e321bc5c QML engine: Fix binding setup
We set QProperty bindings up in the wrong way: Parent components would
overwrite their child component's binding. This patch reverses the
order, fixing the bug.

Task-number: QTBUG-87153
Pick-to: 6.0
Change-Id: I3e90d1d14a41a7c5c337745f1453484d360a3979
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-12-03 21:46:24 +01:00
Fabian Kosmale 6eb35df60e QML engine: Deprecate DefaultMethod
Assigning objects to signal handlers can be convenient, as seen in the
examples which use it together with ListView.onRemove.
However, that convenience makes it hard to reason about what actually
happens. Moreover, the only user of that functionality are the Animation
classes, and the usage of DefaultMethod is not documented anywhere.

[ChangeLog][QtQml] Assigning an object to a signal handler is deprecated.
Instead, create the object, give it an id, and call the desired slot
from the signal handler. For instance, instead of of
ListView.onRemove: SequentialAnimation {...}
use
SequentialAnimation {id: removeAnimation; ...}
ListView.onRemove: removeAnimation.start()
A warning will be printed whenever an assignment of an object to a
signal handler occurs. The warning can be controlled via the
qt.qml.defaultmethod logging category.

Change-Id: I001ddf4d7933871977f84a5e012d020fb043cc64
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-12-03 21:12:42 +01:00
Qt Submodule Update Bot 7757992495 Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: Ic815609bf282adb00203f3bc39db6380971ed28f
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2020-12-03 19:36:51 +02:00
Fawzi Mohamed 9f56f7f786 qmldom: DomItem and common API
This commit adds the main API of the Dom model:
The idea of the Dom Model is to expose a simplified an uniform model,
while keeping typed objects (as one is used in C++, and ideally using
the modern C++ approach with containers, and avoiding manual memory
management).
In particular this approach avoids reducing everything to an untyped
model.

The central object in this is the DomItem, it is a value type that
keeps a pointer to the actual element.
A non empty DomItem always keeps some context (a canonicalPath)
and one can explore its containers and its contents.
Non existing or missing values simply translate to empty DomItems
and one does not need to check at each step for invalid things.
See the DomItem documentation for more information.
The as() ad ownerAs() templates let one cast back the DomItem to
the underlying elements.

To expose an element with minimal effort one has to mainly implement
the method iterateDirectSubpaths(), and iterate through all elements
contained in that element (see the documentation of DomBase for more
details).
Containers, simple data and references can be wrapped in DomItem
elements just when accessed, so the underlying C++ object can use the
usual containers/datatypes.

A good model should not just be easy to browse, reference and extend
with new elements, it should also have a clear parallelizazion/
multithreading policy.
This is less relevant for a single pass compiler, but for is relevannt
for a code model.
The fact that the current code model now somehow works only from the
GUI thread show the importance of a clear policy when multiple people
can contribute.
In the Dom model there is the following idea:
- During build time pointers to the elements can change (MutableDomItem
  should be used)
- Access to sub elements normally has no locks, they should be either
  accessed by a single thread or immutable.
- OwningItem are the unit of multithread safe updates, the have a
  mutex and protect the parts that need protection
- A DomEnvironment can refer to a parent Environment, perform several
  changes (in a separate thread), and commit them all at once (in a
  sparate commit).

This commit contains all the main API, and tests for it.
The bulk of the concrete element will be in followup patches.

Task-number: QTBUG-74840
Change-Id: I9e14e8560e3b4aa3268a733fed37e9090c18e3ab
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-12-03 16:42:24 +01:00
Ulf Hermann 5e491b77b9 QmlCompiler: Make QQmlJSScope const-correct
You should not be able to retrieve a non-const parent or child scope
from a const scope. That defeats the whole point of keeping the scopes
const after loading.

Change-Id: If3734c65ee902c32939a54a67193d5f6276cd016
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-12-03 15:36:22 +01:00
Kai Koehne 7a4ac2060f Doc: Do not highlight "Writing QML Extensions with C++" example
This is a more complex example that is also not that visually appealing.

Change-Id: Ia5ebfa407c6bcbd3d701068384bfd660833a867c
Reviewed-by: Tuukka Turunen <tuukka.turunen@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 86b9ae4da1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-12-03 12:15:10 +00:00
Volker Hilsheimer f4ce3ae091 Don't return reference to temporary QModelIndex
Follow up on change in qtbase; QPMI casting to QModelIndex returns a
value, not a reference.

Change-Id: I227cd8ef64450986069837edee25512d9538286d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 039c2801cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-12-03 12:15:10 +00:00
Fabian Kosmale 513a8007ab Simplify QQmlPropertyCache::isDynamicMetaObject
Qt 6 does not have metaobjects with revisions < 3.

Change-Id: I525e88fa7a907240cd9553ad7b067a28a9793ae7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-12-03 10:38:45 +01:00
Fabian Kosmale 47ce18fae9 QQmlValueTypeFactory: remove bespoke Qt type cache
QQmlValueTypeFactory contained an array of size QMetaType::User, to
avoid locking for accessing user types.
In Qt 6, User is however significantly larger, causing the array to take
roughly 500 KByte of memory. We therefore unify the handling of user
types and Qt built-in types, by storing all of them in a QHash. We
replace the mutex with a read-write lock to still allow concurrent
read access to the mapping (now for all types and not only Qt builtin
types).

Change-Id: Ie22786b0f33cf27157b151c75d5bb21579a566f6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-12-03 10:38:44 +01:00
Fabian Kosmale 35296f7037 QQmlPropertyCache: Remove unused copyAndAppend overload
Original-patch-by: Lars Knoll <lars.knoll@qt.io>
Task-number: QTBUG-88765
Change-Id: I85dad61a1c3ade29137be9870ce8af726be81a28
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-12-03 10:38:43 +01:00
Fabian Kosmale 77c02343e2 Use QMetaType instead of metatype-id, take 2
This time, the ValueTypeFactory gets converted. As a consequence, many
callers get touched again.

Task-number: QTBUG-88766
Change-Id: I3a8b7d5cfeb7fac85daf1702febba205971d4256
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-12-03 10:38:43 +01:00
Qt Submodule Update Bot 76aa1d578d Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: Id85f2884062c345f1f67db19128c5fae3d48b6e6
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2020-12-03 10:13:32 +02:00
Kai Koehne 3bf876a771 Document how to use CMake for Qt QuickTest
Task-number: QTBUG-73058
Pick-to: 6.0
Change-Id: Ia00916e8ce8193225a773f85fe2af87e334afaab
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-12-03 09:12:15 +01:00
Qt Submodule Update Bot 53a9be1a8c Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: I465e25771ca53080ca67757801cf9646a135f1bb
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2020-12-03 03:30:37 +02:00
Ulf Hermann 6cfe4cbebb Mark url as builtin type
Also, allow conversion from UrlObject and String. We allow the string
conversion because we treat string and url as interchangeable in various
places.

Change-Id: Ib229c6d190e1c5d849ea18798925965b8dbeef7e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-12-02 21:44:16 +01:00
Qt Submodule Update Bot 9664d9346a Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: I048e99254e235217b7dc1fa1e3ae58ac0abd75fd
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2020-12-02 22:03:31 +02:00
Kai Koehne 1d53e24760 Doc: Use explicit linkage with target_link_libraries
The Professional CMake book suggests always using explicit linkage with
target_link_libraries, so let's use that.

Whether to use PUBLIC or PRIVATE depends on the context. But let's
be conservative and advise on using PRIVATE by default.

Also prefer the versioned target name over the unversioned one.

Task-number: QTBUG-88935
Change-Id: I29a6b07803d7aab10eb93a5348d12b9d1620d132
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Craig Scott <craig.scott@qt.io>
2020-12-02 19:00:03 +01:00
Andreas Buhr 815b347abe Fix documentation for qmlInfo, qmlDebug and qmlWarning
qmlInfo, qmlDebug, and qmlWarning are not in the QtQml namespace any
more. This patch adapts the documentation.

Task-number: QTBUG-88533
Pick-to: 6.0
Change-Id: I7fafd3fc2769c5ffad515cacaacdc7ccbe07db46
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-12-02 18:44:30 +01:00
Andreas Buhr 1ea475099c Add documentation dependency to qtshadertools
Documentation links to qtshadertools. This patch adds qtshadertools
to the dependencies so these links can work.

Pick-to: 6.0
Change-Id: Icb059fd681e7456f3452aeba60287bfa1cc3539e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-12-02 18:44:26 +01:00
Andreas Buhr ed098189d5 Fix usage of oldcode and newcode in qt6-changes.qdoc
There was wrong usage of \begincode and similar commands.
This patch fixes it.

Task-number: QTBUG-88533
Pick-to: 6.0
Change-Id: I70b3d0104ba1dc8eb44556f35fc552e259317f88
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-12-02 18:44:23 +01:00
Qt Submodule Update Bot 9d0c455c4b Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: If118a65dd9ac04cdd0da070e061df34ab97c9187
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2020-12-02 18:04:02 +02:00
Ulf Hermann d6fb8791ab Let AOT-compiled functions modify their arguments
It allows for more natural looking generated code and there is no
downside. The arguments are specially prepared for the call anyway.

Change-Id: I8437e93adb1c67db1b53fbdb29cbea10f6ef278f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-12-02 13:06:27 +01:00
Ulf Hermann 8a555cc22a Quick: Fortify QQuickApplication ctor
If the qApp we have is in fact not a QGuiApplication we cannot
connect those signals. The "if (qApp)" was probably supposed to check
for this but actually doesn't because qApp is a static_cast.

Pick-to: 6.0
Change-Id: Iaa30e3d56768e97601d51d30500fc3b12d0626a3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-12-02 12:06:19 +00:00
Ulf Hermann 1ba57c41a9 Construct arguments for AOT-compiled functions before metaTypeFromJS
metaTypeFromJS expects to assign the value using regular operator=. That
destructs the old value and therefore the old value has to exist.

Change-Id: Ife443b184c30d658f42b65c6717e80685f6635d5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-12-02 13:06:11 +01:00
Lars Knoll 7cf80e6de0 Remove the property cache from QQmlValueTypeWrapper
Instead operate directly on the meta object.

We could maybe have an optimization, where we have a global map
from id to QQmlPropertyData for each value type.

Task-number: QTBUG-88765
Change-Id: I259a06ba116a536b56380c2636737c6c016665d9
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-12-02 12:54:53 +01:00
Fabian Kosmale 7163d6b2a4 Remove the pointer to the property cache in QObjectMethod
It's not being used anymore.

Original-patch-by: Lars Knoll <lars.knoll@qt.io>
Task-number: QTBUG-88765
Change-Id: Ieab1cba6c664c65d123d8f1ffd6db5878010f965
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-12-02 12:54:52 +01:00
Fabian Kosmale e5f06d6024 Unify overload resolution code and introduce a cache
With this approach we can also avoid passing the property cache around.

Original-patch-by: Lars Knoll <lars.knoll@qt.io>
Task-number: QTBUG-82931
Change-Id: I88f770d5d9a31b2f5071ad457d9a830900130a85
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-12-02 12:54:51 +01:00
Fabian Kosmale 9e81149dd8 QQmlPropertyCacheCreator: return metatype in metaTypeForParameter
Instead of returning the id. Callers still use the id.

Change-Id: Ia075c3bbfa2421048483e427d9e6e6f1a20c3b61
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-12-02 12:54:50 +01:00
Qt Submodule Update Bot 42b7471550 Update dependencies on 'dev' in qt/qtdeclarative
Change-Id: Id94757dff635d6a2067eb36bb04d2499bcde13e5
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2020-12-02 11:39:23 +02:00
Ulf Hermann 9aba23c99e Allow passing --qmljs-runtime to the qmlcachegen implementation
This signals qmlcachegenplus to not paste the whole JavaScript type
system into each generated file. In turn, user projects need to add a
dependency in order to build against the JS runtime.

qmlcachegen ignores the option.

Change-Id: I0f87dedb969e99e94fbb712b7faa23d84f76dfbe
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-12-02 08:59:12 +01:00