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>
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>
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>
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>
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>
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>
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>
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>
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)
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>
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>
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>
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>
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)
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)
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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)
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>
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>
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>
...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>
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>
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>
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>
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>
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>
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>