Commit Graph

23181 Commits

Author SHA1 Message Date
Fabian Kosmale c7d518ca7c ItemDelegate: Use required properties in example code
Change-Id: I11d7c35beb966b1d99909c32365939d97b5672a6
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit f4776d4d7e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-31 21:16:53 +00:00
Mitch Curtis ce77d45d89 Fix attached property propagation when accessed on QQuickPopupItem
As mentioned in the comments of QTBUG-68434, popups always inherit
their attributes from the parent window (unless they are explicitly
bound like in ComboBox). However, ComboBox was made an exception,
because the popup is an integral part of the control.

This means that although the following snippet shouldn't change the
background color of a Popup, it should do so for ComboBox's popup:

    Rectangle {
        Material.theme: Material.Dark

        ComboBox {
            model: 5
        }
    }

However, this didn't work.
Before 3ec6d04d97, material/ComboBox.qml
had the following binding in the popup's background Rectangle:

    color: control.popup.Material.dialogColor

That patch changed it in order to get deferred execution working:

    color: parent.Material.dialogColor

This causes the color to come from the window rather than the popup.
This would have almost been caught in test_comboBox, had we checked the
actual color when setting the theme.

To fix the bug without reverting to the previous QML and breaking
deferred execution, we modify findAttachedParent to return the popup's
attached object if the item passed to it is a QQuickPopupItem.

Doing this causes test_inheritance_popup to fail, so we fix that by
passing the attached object target (which can be a popup) to
findAttachedParent, rather than the item whose parent or window changed
(which is coincidentally what was already being done in initialize()).

The patch also adds categorised logging to help debug such issues in
the future. Conveniently, this will also help users who want to debug
their own QQuickAttachedPropertyPropagator subclasses, without them
needing to modify Qt itself.

Fixes: QTBUG-115322
Change-Id: Idc0495023a058bcb033c4002fb6ad233bae9feae
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c6b401a31a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-31 15:51:59 +00:00
Laszlo Agocs 7434dcf618 doc: Note in QQuickGr.Conf. that pipl.cache is disabled on Metal
Follow the qtbase change that, for now, makes the Metal backend of
QRhi never initialize an MTLBinaryArchive, meaning the pipeline
cache will be completely empty. (from Qt's perspective, the OS
will likely do its own persistent caching regardless)

Task-number: QTBUG-114338
Change-Id: Ic2c2488029d77c23f1183b36248aaaa15dd275ad
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit ea63dbfa19)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-31 13:14:00 +00:00
Laszlo Agocs 24fb595ca4 sg: Fix dirty bit when changing mirror for QSGSimpleTextureNode
Not setting DirtyGeometry leads to subtle update problems in
scenes where the value is dynamically toggled. Most commonly the
changed mirroring value does not always take effect, but rather
only when something else triggers something geometry-related.

Change-Id: I6a00e1399ebeec3120b0f695cf0e10507f0ad807
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 45baa640b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-31 13:13:52 +00:00
Fabian Kosmale 1b8c6d9596 Context properties: Don't trigger an assert for numeric names
The logic in our IdentifierHash assumes that every entry is a
StringOrSymbol; however, IdentifierTable::asProperyKey will convert keys
that look like numbers to ArrayIndex instead.
This is noramlly what we want, and not an issue, except for
setContextPropery where the user can pass an arbitrary string that is
not necessarily a valid identifier. In an ideal world, we would just
disallow such identifiers, but for backward compatibility change the
code to handle this case (avoiding a Qt internal assert).
We only need to modify the QString overloads, as those are the only ones
that interact with unsanitized user input.
A later commit will modify setContextPropery to warn if the key is
numeric.

Fixes: QTBUG-115319
Change-Id: Ifc4e4d2bc99321836e6976c4cbd0c5ff687b430c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit b2b90c7cf5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-31 10:10:03 +00:00
Fabian Kosmale 869d1b9c55 QQmlPropertyBinding: Correctly link observers after undefined valued binding
Calling both setObservers and prependObservers doesn't make sense:
setObservers is for the case where we don't have a binding, but
obviously we do have one here.

Note that the test case still passes even without the fix - it will
however cause a memory leak which can be detected by ASAN. The leak is
fixed by this patch.

Fixes: QTBUG-115251
Change-Id: I4b420e05f49acf764da6a05af522390005276f49
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 366fee74fc)
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-31 09:21:59 +02:00
Shawn Rutledge 5f2fdfc640 QQuickWidget: give each mapped mouse event the same QEventPoint
Counter-intuitively, this is done by setting the timestamp. Every time
you construct a new mouse event, you always need to call setTimestamp()
for the obvious reason: the timestamp is not a ctor argument, but it's
important for some event receivers. But the non-obvious reason is that
QMutableEventPoint::setTimestamp() has other useful side effects:
the velocity calculation is done there, sensibly enough. But to make
that possible, it also looks up the persistent QEventPoint with the same
ID as the one in the QMouseEvent, and that's the most important to fix
QTBUG-114258 specifically.

QQuickFlickablePrivate::handleMoveEvent() calculates delta as
QEventPoint::position() - mapFromGlobal(globalPressPosition())
and then QQuickFlickablePrivate::drag() does the drag threshold check.
If globalPressPosition() is 0,0 because the persistent QEventPoint
was not passed along in the mapped QMouseEvent, that delta is nearly
always over the drag threshold. So Flickable took the exclusive grab
at the first possible opportunity: the second move after press.

Fixes: QTBUG-114258
Change-Id: Icaf7fb8fde0ef01b486ccf16852ef0f6cfb6a64c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7ae07f49c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-28 20:26:14 +00:00
Shawn Rutledge 795686be3f SwipeDelegate: use QEventPoint's pressed pos for drag distance
QQuickAbstractButtonPrivate::pressPoint may not be set correctly,
and we don't need it for this purpose anyway in Qt 6, since every
QEventPoint is supposed to remember its own press position.

Task-number: QTBUG-61783
Change-Id: Idd82f3d79b1167a40f28669d15b5974c7d240a9c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 0f4eb2320c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-28 10:25:06 +00:00
Ulf Hermann 79175ef102 QML: Do convert objects with prototypes to QVariantMap
While we shouldn't convert to QVariantMap if only QVariant is requested,
we should convert if QVariantMap is explicitly requested. QVariant can
hold QJSValue which is a better fit for objects with properties.
QVariantMap cannot hold QJSValue. A best effort conversion is still
better than an empty map.

Amends commit 47678c682f.

Fixes: QTBUG-115523
Change-Id: Iaa96809ee411dc0db95311c641c4e3f1f51a6026
Reviewed-by: Amanda Hamblin-Trué <amanda.hamblin-true@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit afe96c4d63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-28 07:42:42 +00:00
Ulf Hermann 8aeef636ba QmlCompiler: Force QObject* for LoadElement on list properties
In the presence of incomplete type information we may otherwise conclude
that the value type is QJSValue and generate broken code.

Change-Id: I533f704a422d0efe8b7b5bb0a170966e9f290b1f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 81bab13560)
2023-07-27 10:18:55 +02:00
Shawn Rutledge f08c708324 doc: Remove readonly tag from PinchHandler persistent properties
Amends a432970b25

As a drive-by, remove redundant categorized logging output, which
wrongly implied that starting scale could be set from the target scale.

Task-number: QTBUG-76739
Task-number: QTBUG-94168
Change-Id: I1fad79b58fa20e165fd21bc593a27cff8378b7ea
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 442eeba672)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-26 20:24:21 +00:00
Ulf Hermann aee2cdd6ec QML: When marking a QObjectWrapper, also mark its const counterpart
Otherwise the const wrapper will be swept while the object should still
be alive (and vice versa).

Amends commit d3b3fef5a8.

Fixes: QTBUG-114596
Change-Id: Ib4d8e9f805a229a471ca72f5ff357e3a4c9999a5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit ffa15d0e21)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-26 12:06:42 +00:00
Ulf Hermann 051e3c95a8 QV4::ArrayData: Fix offset calculation for sort()
We cannot just sort the raw values. We have to take the offset into
account. If the array wraps around the end of the allocation, we have to
move it around to be contiguous.

Fixes: QTBUG-58718
Change-Id: I1866b3f271d97352e250d687955af3fc54340334
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit f0b2fbcf47)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-25 14:43:01 +00:00
Jaishree Vyas 1226012798 Doc: Remove \ingroup all-examples command from the docs
Task-number: QTBUG-115044
Change-Id: I69fa38a974c6143b862af1bc4fb27a73508406bc
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 1c01b3cc8a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-25 14:43:01 +00:00
Andy Shaw 03768788d4 doc: Fix typo in qt_deploy_qml_imports example
Change-Id: I52869a202169d7cc4bcf5337bcd61b10a68915de
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit c3e40c8997)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-25 14:43:01 +00:00
Alexey Edelev addbcd49c3 Fix the plugin class name handling in qt6_add_qml_plugin
If the CLASS_NAME is not specified and the BACKING_LIBRARY exists
we should get the plugin CLASS_NAME from the backing library, but
not from the non-existing plugin target.

Change-Id: I51ba2290f8f9cb8bcf4217f535c6aa4e676f7293
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit e97f1631c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-25 14:43:01 +00:00
Ulf Hermann 3d2418b74e QmlCompiler: Optimize storage for register variables
We don't need nested hashes there. A single hash is enough, and we also
don't need to key it by pointers. Keying it by internalName instead
makes the ordering deterministic. We also don't need to duplicate-track
the variable names when outputting the declarations anymore.

Verify that qmlcachegen's output is actually stable by compiling the
entire test data for tst_qmlcppcodegen twice, packaging the generated
code into the resource file system, and comparing it in a separate test.

Fixes: QTBUG-115159
Change-Id: I659661e58a52ed9ff308c83d6c821cf016f2e94e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit fb4cc245e0)
2023-07-25 13:30:47 +02:00
Ulf Hermann b1af4d9dbc QML: Unify treatment of wrappers when dealing with QObjectMethod
A method can belong to a QObjectWrapper, a QQmlValueTypeWrapper, or a
QQmlTypeWrapper. store only one wrapper pointer and allow for all
variants. Furthermore, keep a reference to the wrapper so that it
doesn't get garbage collected. We still need it to retrieve the
metaobject, even if we're calling the method on a different instance.

Fixes: QTBUG-115115
Change-Id: I1759fb687918ff79829fef776e0a93d29373b30f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 63b622d590)
2023-07-25 09:54:11 +02:00
Ulf Hermann 787a874835 V4: Use memmove() for tail calls
If you have many arguments, the argument ranges can overlap. In that
case memcpy is UB.

Fixes: QTBUG-115320
Change-Id: I54dd4d7762e7278502954b8ac2cb4af1197ce88c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d4a6673d2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-24 21:58:21 +00:00
Venugopal Shivashankar 53535358eb Doc: Add example category for Qt Qml examples
Also, removed the \example command for a couple
QML tutorial pages.

Task-number: QTBUG-115226
Change-Id: Ia3b988d369402b59c1a191fae12a5e8119ecbcab
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 6d64967f85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-21 15:22:09 +00:00
Marc Mutz a56a56b1e8 QtQuick: unbreak unity-build-batch-size 100000
Exclude TUs that cause problems in a build where all of QtQuick's .cpp
files end up in a single unity_0_cxx.cxx. This should ensure that the
build will forthwith not fail because someone added a new .cpp file in
the "wrong" position.

Of course, this is just a snapshot, with my configuration: Clang 15,
Ubuntu 20.04, -developer-build, C++23, -sctp, libc++, ...

Task-number: QTBUG-115140
Change-Id: Iea1fd344541b966add097a7e0c144a427edabd94
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 174e3fd026)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-21 10:32:28 +00:00
Marc Mutz d9d1542c08 QtQmlTypeRegistrar: unbreak unity-build-batch-size 100000
Exclude TUs that cause problems in a build where all of the library's
.cpp files end up in a single unity_0_cxx.cxx. This should ensure that
the build will forthwith not fail because someone added a new .cpp
file in the "wrong" position.

Of course, this is just a snapshot, with my configuration: Clang 15,
Ubuntu 20.04, -developer-build, C++23, -sctp, libc++, ...

Task-number: QTBUG-115140
Change-Id: I06a1525b8bfe39c2f8c39f33e3d3de533257f4a1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 517ea74cac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-21 10:32:28 +00:00
Marc Mutz a3cc123988 QtQuickTemplates: unbreak unity-build-batch-size 100000
Exclude TUs that cause problems in a build where all of
QtQuickTemplate's .cpp files end up in a single unity_0_cxx.cxx. This
should ensure that the build will forthwith not fail because someone
added a new .cpp file in the "wrong" position.

Of course, this is just a snapshot, with my configuration: Clang 15,
Ubuntu 20.04, -developer-build, C++23, -sctp, libc++, ...

Task-number: QTBUG-115140
Change-Id: I2dfee74c517a2e96efb16f39217deabf8580e70e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 268efe1325)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-21 10:32:27 +00:00
Marc Mutz 0e20d65bc0 QtQml: unbreak unity-build-batch-size 100000
Exclude TUs that cause problems in a build where all of QtQml's .cpp
files end up in a single unity_0_cxx.cxx. This should ensure that the
build will forthwith not fail because someone added a new .cpp file in
the "wrong" position.

Of course, this is just a snapshot, with my configuration: Clang 15,
Ubuntu 20.04, -developer-build, C++23, -sctp, libc++, ...

Task-number: QTBUG-115140
Change-Id: If3cb7c17548710dca3b6111b33a4d3ca70417728
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7e587fb00d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-21 10:32:19 +00:00
Aleix Pol 0dd96b57b6 Fix fetching data when reuseItems is true
QQmlDelegateModelPrivate::requestMoreIfNecessary() is called in various
situations, including at startup, which calls QAIM::fetchMore() on the
model if it supports that. But we need to do it in one more case:
when delegates are being reused from the cache, the model could provide
more rows even though we aren't instantiating new delegates.

Amends 1841a9e41d

Fixes: QTBUG-95107
Change-Id: I5b7ff48345ab78977cb03cfcf58ed96a57c831bd
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 589d0ee473)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-21 05:18:51 +00:00
Cajus Pollmeier ec29b7f67b QQuickMenu: remove contentItem children change listeners on destruct
QQuickMenu causes a race condition (crash) on destruction, due to not
removed children listeners in some cases. This patch removes the
listeners manually on destruction.

Fixes: QTBUG-108144
Change-Id: I4c166c782ae014236970a1f9e145f6862cd7c6a9
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit a7c4507b14)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 07:43:14 +00:00
Olivier De Cannière 86ced98cea QML: Export de-inlined functions in ObjectWrapper
Amends 63b622d590

Change-Id: I61a37fb9b66eef7f141f1f110c7688c660baff93
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit b460361c4c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-17 15:55:56 +00:00
Bartlomiej Moskal 66bf731ddf Doc: add information about preeditText in text property
The documentation for the TextEdit::text and TextInput::text properties
was missing information about preeditText. This may result in the
expectation that text property will always contain all displayed text.

Fixes: QTBUG-109306
Change-Id: Ifa0b214238633a42e9772f796547f776a0d4251c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 1ca4bb6347)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-14 07:53:46 +00:00
Mitch Curtis 50f440deec doc: mention C++ compiler benefits of compile-time style selection
Task-number: QTBUG-110827
Change-Id: I419f37ffcc6a1487ccaa63ddc01adc9d5eb9352e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit f621aa484b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-13 03:45:59 +00:00
Jan Arve Sæther 1613dac3ae Move imagine/musicplayer to tests/manual/imagine/musicplayer
imagine/automotive already demonstrate the imagine style

Task-number: QTBUG-108751
Change-Id: Ibb1fe187571b6693b85dfc0a310fc806908194dc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 6e99bddb9e)
2023-07-12 00:25:52 +02:00
Jan Arve Sæther cf71d02152 Fix pointer delivery to child items of items with clip:true
QQuickDeliveryAgentPrivate::pointerTargets() can visit a lot of items
and their handlers, before actual event delivery really starts. One optimization in place since 6adc36115f
is that if an item is clipped, and the point is outside its bounds,
we can be sure that it's also irrelevant to the item's children,
because the parts of any children that may be under that point
are clipped away and invisible. At the time that was written,
QQuickItem::contains() was only doing a simple bounding-rect check.
Since then, bf74a908cb added
containmentMask; and we should also keep in mind the precedence
of the PointerHandler.margin property (currently, TapHandler.margin
does not expand the sensitive area beyond a clipped Rectangle, or
beyond the containmentMask either). So it seems we now need to check
clipRect().contains() explicitly: a child item may be outside its
parent's containmentMask, and containmentMask does not affect clipping,
so one would expect to still be able to interact with the child.
The current definition of clipRect() is from
9b62f4c27a. It's virtual, but
documented as "the region intended to remain visible if clip is true".

Fixes: QTBUG-115179
Change-Id: I6ae8f492b99725459cdff2a89ac8508da5167102
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit f33146ed0a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-11 22:12:36 +00:00
Ulf Hermann 0b942a8d87 QQuickListView: Do not re-parent existing contexts
If we're not creating a new context, we should not re-parent it.
Otherwise it gets deleted in unexpected moments.

Amends commit 471c909a68.

Fixes: QTBUG-115106
Change-Id: Ib51d80dda07096587c64ac2262d115ea08855cd2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 20f608651b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-11 19:55:56 +00:00
Kai Köhne 3b3bce5d2c Doc: Fix typo in qt_add_qml_module() description
Change-Id: Ic55b011704281d8334fff868e0c651d867e9f6ad
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 29f04ff888)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-11 18:12:28 +00:00
Mitch Curtis b18f3659a2 QQuickTableViewResizeHandler: don't accept events outside of us
Handlers can be sent events that are outside of the target
item, so check for that in wantsEventPoint.

Fixes: QTBUG-111013
Change-Id: I52f17fc7030a93d999188fe7608411f11d235858
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 345189c469)
2023-07-10 11:26:36 +08:00
Ulf Hermann cd1606969e QtQml: Fix validation when calling methods with different 'this'
We were checking the wrong method offsets and we didn't check for
destroy() and toString().

Amends commit 3fd3a2a9d0.

Change-Id: I8ebeb927a7827cc1fd3394fb3ab589c35d31ab70
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 8b1ee76623)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-09 19:42:15 +00:00
Ulf Hermann 3f0f38f917 QtQml: Do not crash on invalid import URLs
We get rather unusual file URLs if we let an import with an invalid URL
pass. Once those files are referenced, we hit some asserts.

Change-Id: If7acefcd07c844e680be9db6e49b5ef366baea4b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 8a073501ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-09 19:42:03 +00:00
Ulf Hermann b737337f3b QtQml: Respect import namespaces when importing scripts
Fixes: QTBUG-113991
Change-Id: I47651f303bcb53dc214d5f6bc70f65bac32f1b09
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 1c2ef41a88)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-09 19:41:59 +00:00
Ulf Hermann ad529b77f2 QML: Check result when constructing object from metaobject
If you pass insufficient arguments to call the ctor, the resulting
object is null and cannot be used.

Fixes: QTBUG-114910
Change-Id: Ib184684b6a7665bcdc1a3fe8f8a2401a33a8ac1c
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 3110117bfa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-06 19:28:35 +00:00
Ulf Hermann bca9e06ac3 QmlCompiler: Do not generate code that shadows arguments
Fixes: QTBUG-114897
Change-Id: I23bc913a86ee90764735c1661cd5036f7d177a22
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit b7b63ba92c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-06 19:28:20 +00:00
Topi Reinio b140dec114 Doc: Fix documentation issues for Affector and PathView QML types
qquickcustomaffector.cpp:13:
    (qdoc) warning: Undocumented parameter 'particles' in
    Affector::affectParticles().
    (qdoc) warning: Undocumented parameter 'dt' in
    Affector::affectParticles().

qquickpathview.cpp:1511:
    (qdoc) warning: No such type 'QQuickPathView' in QML
    module 'QtQuick.

Change-Id: I0c21af05781dcfaf0e76b4cdf7406a97d7bc20d2
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit 1cf5665e15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 14:52:12 +00:00
Shawn Rutledge 5a85af7e01 doc: Add note about Window.color translucency
Task-number: QTBUG-112537
Task-number: QTBUG-113456
Task-number: QTBUG-115015
Change-Id: I4220dd0669f1e58a3acfb8be1f826ea0e18d972f
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit fd56ad806b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 14:52:11 +00:00
Topi Reinio db6c4effdb Doc: Fix linking to QtCore.Settings QML type
Fixes QDoc warnings: Can't link to 'QtQmlCore::Settings'.

Change-Id: I3e34a5a3f3a360391f3d1fbb00b17f617d02dc72
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
(cherry picked from commit 87115131e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 14:52:11 +00:00
Kai Köhne d9f49b4622 Doc: Fix a link in QQmlContext documentation
Change-Id: I039ba043733bb114d798f5583752edc4af21d4a1
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 52f1376924)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 11:12:49 +00:00
Laszlo Agocs c72934028c Make key event forwarding functional with QQuickRenderControl
...in applications that only use the public API and so reimplement
the QQuickRenderControl::renderWindowFor() virtual.

For more complex cases one needs to reimplement a virtual in the
private class as well (QQuickRenderControlPrivate::isRenderWindow())
but simple apps do not need that (e.g. because they have a single
on-screen window and a single off-screen window).

However, right now isRenderWindow() is the only function that is
used when deciding if the "window" has focus. So apps that do not
reimplement the private virtual are in trouble.

By providing a simple default implementation that falls back on
renderWindowFor (the public virtual), we can keep most
applications working and avoid the regression we've been seeing in
the past few releases.

Whereas QQuickWidget is not affected since that reimplements both the
public and private virtuals. That is an example of a complex case where
(to support graphics view proxy widgets) one needs to provide a proper,
custom implementation of the private virtual (isRenderWindow).

Amends 8c0b1e06d9

Fixes: QTBUG-114961
Change-Id: I024f68da7f4260191b67be89b8957b47004e8339
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 73b80e1b42)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 10:34:18 +00:00
Axel Spoerl 8c3471765d Fix compiler warning in QQmlDelegateModelPrivate::itemsRemoved()
Iterators were used to remove multiple cache items. The begin iterator
was (implicitly) const, while 'end' wasn't. This triggered a compiler
warning.

This patch makes both iterators explicitly const.

Change-Id: If2e2f91b9faebe1e45d196b24ce69d8dad4dd898
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 16c448e301)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 07:02:59 +00:00
Mitch Curtis 30015a617e Doc: explain how to always show ScrollBar when needed
Until we e.g. add a transient property to ScrollBar, we should document
how users can ensure that it is always visible when the content size
exceeds the view size.

Task-number: QTBUG-76895
Change-Id: Iaf755f51ca9fd3865ae710a2cba13b58b897930e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 62e3830944)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 07:02:59 +00:00
Axel Spoerl 228efa08af QQmlDelegateModelPrivate::itemsRemoved - keep persisted items in cache
QQmlDelegateModelPrivate::itemsRemoved removes unreferenced items from
the cache. If an item is persisted and unreferenced, it's disappearance
from the cache will prevent display models (e.g. qqmllistmodel) from
looping over all delegates. This can lead incomplete clear operations
and dangling screen artifacts.

This patch adds a condition to prevent persited items from being
removed from the cache.

It adds a test function in tst_QQmlDelegateModel.

Fixes: QTBUG-98365
Change-Id: I52e6344be85ca64eadbf44378de32cde126ff07a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit da38eaf433)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 04:39:36 +00:00
Volker Hilsheimer 7eb239d43e Don't crash when using unshift on a states group
Amends 7e4b179430, which implements
Array.unshift by first appending nullptrs, then replacing those with
the existing previous items, and then replacing the old positions (now
nullptr) with the items to be prepended.

This assumes that the append implementation of a list property accepts
nullptr items, which QQuickStateGroup's implementation didn't.

Note: QQuickStateGroupPrivate::append_transition also doesn't append
a nullptr, and it is likely that other list property implementations
also make append(nullptr) a no-op.

Fixes: QTBUG-114858
Change-Id: Ib0459c2d12be5deb42563b5298f840d8ba641930
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit f905876d6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 15:44:38 +00:00
Eskil Abrahamsen Blomfeldt bd08147028 Pass render mode correctly to material for all cases
One of the code paths that call createShader() was not passing along
the render mode, causing it to default to 2D rendering. This could
cause issues when rendering a 2D item in 3D if the material has
special handling of perspective transforms, like e.g. with text
which needs a different shader to get correct antialiasing in 3D.

Change-Id: I4a22642863df58351daeec63e99b54a986b4b45e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit ca558d3d59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 15:44:32 +00:00
Volker Hilsheimer c8235e713d QQmlListWrapper: throw type errors or warnings if append fails
Some list implementations don't accept nullptr object and don't grow the
underlying list. This breaks assumptions made in e.g. unshift() or
set_length(), which increase the size of the list by appending nullptr
objects.

Throw type errors if lists don't come back with the correct size after
the calls to append. For the push method, which has accepted this
behavior for a long time, we only generate a runtime warning and return
the actual length of the list.

Change-Id: I4623292d2ec2b3343f119d789064ee69ebe90cb5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 14e7034bb0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 15:44:30 +00:00