Accepting request 1218254 from KDE:Qt6

- Add upstream changes:
  * 0001-QQuickItemView-fix-crash-with-zero-size-SwipeView-th.patch
    (QTBUG-129622, kde#493854)
  * 0001-QQuickAccessibleAttached-Let-implicit-names-work-whe.patch
    (QTBUG-130360)

OBS-URL: https://build.opensuse.org/request/show/1218254
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/qt6-declarative?expand=0&rev=42
This commit is contained in:
Ana Guerrero 2024-10-27 10:24:05 +00:00 committed by Git OBS Bridge
commit 9645fe4661
4 changed files with 256 additions and 0 deletions

View File

@ -0,0 +1,116 @@
From 71a9938f4e093c77fc7b9f1cf8043e6d3552aff3 Mon Sep 17 00:00:00 2001
From: Aleix Pol <aleixpol@kde.org>
Date: Tue, 22 Oct 2024 02:47:48 +0200
Subject: [PATCH] QQuickAccessibleAttached: Let implicit names work when
there's a proxy
QQuickAccessibleAttached has infrastructure to provide an implicit name
that we were bypassing now that we have proxies (introduced in 6.8).
We should only use the name of the proxy when it's being set, otherwise
we better provide the implicit name.
Amends 7bdeea2c309150c8b49558b135232926d6a89c50.
Fixes: QTBUG-130360
Pick-to: 6.8
Change-Id: I37470e1f28e837bdbb304726ee85f45ba6577621
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
---
src/quick/items/qquickaccessibleattached_p.h | 2 +-
.../data/actionAccessibility/button2.qml | 9 +++++
.../accessibility/tst_accessibility.cpp | 36 +++++++++++++++++++
3 files changed, 46 insertions(+), 1 deletion(-)
create mode 100644 tests/auto/quickcontrols/accessibility/data/actionAccessibility/button2.qml
diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h
index aa15b43..2d44000 100644
--- a/src/quick/items/qquickaccessibleattached_p.h
+++ b/src/quick/items/qquickaccessibleattached_p.h
@@ -87,7 +87,7 @@ public:
QString name() const {
if (m_state.passwordEdit)
return QString();
- if (m_proxying)
+ if (!m_nameExplicitlySet && m_proxying && m_proxying->wasNameExplicitlySet())
return m_proxying->name();
return m_name;
}
diff --git a/tests/auto/quickcontrols/accessibility/data/actionAccessibility/button2.qml b/tests/auto/quickcontrols/accessibility/data/actionAccessibility/button2.qml
new file mode 100644
index 0000000..1cd1c81
--- /dev/null
+++ b/tests/auto/quickcontrols/accessibility/data/actionAccessibility/button2.qml
@@ -0,0 +1,9 @@
+import QtQuick
+import QtQuick.Controls
+
+Button {
+ action: Action {
+ text: "Pears"
+ Accessible.description: "Show pears some love"
+ }
+}
diff --git a/tests/auto/quickcontrols/accessibility/tst_accessibility.cpp b/tests/auto/quickcontrols/accessibility/tst_accessibility.cpp
index 8bdd945..2018c0e 100644
--- a/tests/auto/quickcontrols/accessibility/tst_accessibility.cpp
+++ b/tests/auto/quickcontrols/accessibility/tst_accessibility.cpp
@@ -33,6 +33,8 @@ private slots:
void ordering();
void actionAccessibility();
+ void actionAccessibilityImplicitName();
+
private:
QQmlEngine engine;
};
@@ -279,6 +281,13 @@ void tst_accessibility::ordering()
void tst_accessibility::actionAccessibility()
{
#if QT_CONFIG(accessibility)
+ if (!QAccessible::isActive()) {
+ QPlatformAccessibility *accessibility = platformAccessibility();
+ if (!accessibility)
+ QSKIP("No QPlatformAccessibility available.");
+ accessibility->setActive(true);
+ }
+
QQmlComponent component(&engine);
component.loadUrl(testFileUrl("actionAccessibility/button.qml"));
@@ -296,6 +305,33 @@ void tst_accessibility::actionAccessibility()
#endif
}
+void tst_accessibility::actionAccessibilityImplicitName()
+{
+#if QT_CONFIG(accessibility)
+ if (!QAccessible::isActive()) {
+ QPlatformAccessibility *accessibility = platformAccessibility();
+ if (!accessibility)
+ QSKIP("No QPlatformAccessibility available.");
+ accessibility->setActive(true);
+ }
+
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("actionAccessibility/button2.qml"));
+
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY2(!object.isNull(), qPrintable(component.errorString()));
+
+ QQuickItem *item = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(item);
+ const QString description = "Show pears some love";
+ QCOMPARE(item->property("text"), "Pears");
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(item);
+ QVERIFY(iface);
+ QCOMPARE(iface->text(QAccessible::Name), "Pears"); // We get the action.text implicitly
+ QCOMPARE(iface->text(QAccessible::Description), description);
+#endif
+}
+
QTEST_MAIN(tst_accessibility)
#include "tst_accessibility.moc"
--
2.47.0

View File

@ -0,0 +1,127 @@
From c343a0bb2a8f87758bf97241223224770e5c4687 Mon Sep 17 00:00:00 2001
From: Mitch Curtis <mitch.curtis@qt.io>
Date: Tue, 22 Oct 2024 13:26:08 +0800
Subject: [PATCH] QQuickItemView: fix crash with zero-size SwipeView that uses
Repeater
When running the minimal example from the bug report, the order of
events is:
1. deletables are iterated in QQuickRepeater::clear(), and deleteLater
is called on the delegate item.
2. deletables are unparented. This causes Container (SwipeView) to be
notified of the parent change and it removes the item. Part of this
involves changing the currentIndex, since the removed item was current.
3. SwipeView's contentItem (ListView) has its currentIndex bound to the
container's, so QQuickItemView::setCurrentIndex is called.
4. setCurrentIndex calls updateCurrent, which detects that the
currentIndex (which is -1, because there was only one item) is out of
range and so releases the item. This causes it to be added to
unrequestedItems, even though it has been scheduled for deletion.
This patch makes QQuickItemView detect that the item is going to be
deleted and not add it to the list of deletables.
Fixes: QTBUG-129622
Pick-to: 6.5 6.8
Change-Id: I999aedbdfafc61ff6d33eb6579331f470e9c1454
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
---
src/quick/items/qquickitemview.cpp | 4 +-
.../controls/data/tst_swipeview.qml | 59 +++++++++++++++++++
2 files changed, 62 insertions(+), 1 deletion(-)
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index 19e5b7f..dabd563 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -2499,7 +2499,9 @@ bool QQuickItemViewPrivate::releaseItem(FxViewItem *item, QQmlInstanceModel::Reu
// One case where this can happen is moving an item out of one ObjectModel and into another.
QQuickItemPrivate::get(item->item)->setCulled(true);
}
- if (!isClearing)
+ // If deleteLater was called, the item isn't long for this world and so we shouldn't store references to it.
+ // This can happen when a Repeater is used to populate items in SwipeView's ListView contentItem.
+ if (!isClearing && !QObjectPrivate::get(item->item)->deleteLaterCalled)
unrequestedItems.insert(item->item, model->indexOf(item->item, q));
} else if (flags & QQmlInstanceModel::Destroyed) {
item->item->setParentItem(nullptr);
diff --git a/tests/auto/quickcontrols/controls/data/tst_swipeview.qml b/tests/auto/quickcontrols/controls/data/tst_swipeview.qml
index 3a7558c..a3dd16c 100644
--- a/tests/auto/quickcontrols/controls/data/tst_swipeview.qml
+++ b/tests/auto/quickcontrols/controls/data/tst_swipeview.qml
@@ -4,6 +4,7 @@
import QtQuick
import QtTest
import QtQuick.Controls
+import QtQuick.Layouts
TestCase {
id: testCase
@@ -760,4 +761,62 @@ TestCase {
tryCompare(swipeListView, "contentX", swipeListView.width, 1000)
compare(item2.x, swipeListView.width)
}
+
+ Component {
+ id: zeroSizeSwipeViewWithRepeatersComponent
+
+ Item {
+ objectName: "rootItem"
+ anchors.fill: parent
+
+ property alias swipeView: swipeView
+ property int d
+
+ Timer {
+ interval: 2
+ running: true
+ repeat: false
+ onTriggered: d = 2
+ }
+
+ SwipeView {
+ id: swipeView
+ contentItem.objectName: "swipeViewListView"
+
+ Repeater {
+ objectName: "swipeViewContentItemRepeater"
+ model: [
+ {
+ title: d
+ }
+ ]
+
+ delegate: GridLayout {
+ objectName: "gridLayoutDelegate"
+
+ Repeater {
+ id: repeater
+ objectName: "delegateRepeater"
+ model: d
+ delegate: Item {
+ objectName: "delegate" + index
+
+ required property int index
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // QTBUG-129622
+ function test_zeroSizeSwipeViewWithRepeaters() {
+ let root = createTemporaryObject(zeroSizeSwipeViewWithRepeatersComponent, testCase)
+ verify(root)
+
+ let swipeView = root.swipeView
+ tryCompare(root, "d", 2)
+ // Shouldn't crash when the model is changed.
+ }
}
--
2.47.0

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Fri Oct 25 11:42:28 UTC 2024 - Christophe Marin <christophe@krop.fr>
- Add upstream changes:
* 0001-QQuickItemView-fix-crash-with-zero-size-SwipeView-th.patch
(QTBUG-129622, kde#493854)
* 0001-QQuickAccessibleAttached-Let-implicit-names-work-whe.patch
(QTBUG-130360)
-------------------------------------------------------------------
Tue Oct 15 09:37:16 UTC 2024 - Antonio Larrosa <alarrosa@suse.com>

View File

@ -41,6 +41,10 @@ Patch1: 0001-Revert-QQmlDelegateModel-fix-delegates-not-being-cre.patch
Patch2: 0002-QQmlDelegateModel-fix-delegates-not-being-created-in.patch
# PATCH-FIX-UPSTREAM
Patch3: 0001-Compiler-Wrap-raw-string-literals-in-QStringLiteral-.patch
# PATCH-FIX-UPSTREAM
Patch4: 0001-QQuickItemView-fix-crash-with-zero-size-SwipeView-th.patch
# PATCH-FIX-UPSTREAM
Patch5: 0001-QQuickAccessibleAttached-Let-implicit-names-work-whe.patch
BuildRequires: memory-constraints
BuildRequires: pkgconfig
BuildRequires: python3-base