1 |
commit: 8ff10340da7993964a7c3ff2f7e0b2ab932f5143 |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Aug 24 08:03:05 2022 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Aug 24 08:03:05 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ff10340 |
7 |
|
8 |
dev-qt/qtquickcontrols2: Fix missing vertical scrollbars |
9 |
|
10 |
KDE-bug: https://bugs.kde.org/show_bug.cgi?id=456574 |
11 |
QTBUG: https://bugreports.qt.io/browse/QTBUG-104983 |
12 |
|
13 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
14 |
|
15 |
.../qtquickcontrols2-5.15.5-QTBUG-104983.patch | 179 +++++++++++++++++++++ |
16 |
.../qtquickcontrols2-5.15.5-r1.ebuild | 37 +++++ |
17 |
2 files changed, 216 insertions(+) |
18 |
|
19 |
diff --git a/dev-qt/qtquickcontrols2/files/qtquickcontrols2-5.15.5-QTBUG-104983.patch b/dev-qt/qtquickcontrols2/files/qtquickcontrols2-5.15.5-QTBUG-104983.patch |
20 |
new file mode 100644 |
21 |
index 000000000000..f31e04d6ff4d |
22 |
--- /dev/null |
23 |
+++ b/dev-qt/qtquickcontrols2/files/qtquickcontrols2-5.15.5-QTBUG-104983.patch |
24 |
@@ -0,0 +1,179 @@ |
25 |
+From d0642867ab629daf36a1194274a74758111140be Mon Sep 17 00:00:00 2001 |
26 |
+From: Mitch Curtis <mitch.curtis@××.io> |
27 |
+Date: Mon, 18 Jul 2022 15:21:49 +0800 |
28 |
+Subject: [PATCH] Fix scroll bars not showing up when binding to standalone |
29 |
+ contentItem |
30 |
+ |
31 |
+908aa77d16e00f2bccc0ddae0f8b61955c56a6a1 hid old scroll bars, but |
32 |
+didn't account for the situation where the old scroll bars would be put |
33 |
+back into place, and so they never showed up. |
34 |
+ |
35 |
+In the case of the linked bug report, since there was a binding to the |
36 |
+ScrollView's contentItem, a default Flickable would be created. After |
37 |
+that binding was evaluated, the contentItem was set, causing the scroll |
38 |
+bars to be hidden (as part of the process of disconnecting from the old |
39 |
+flickable). To fix the issue, we now do the reverse of hideOldItem when |
40 |
+a new contentItem is set. |
41 |
+ |
42 |
+Fixes: QTBUG-104983 |
43 |
+Pick-to: 6.2 6.3 6.4 |
44 |
+Change-Id: I910259cc3e8f6a6231ae6c87c7d4f0f652bd0545 |
45 |
+Reviewed-by: Fabian Kosmale <fabian.kosmale@××.io> |
46 |
+Reviewed-by: Nate Graham |
47 |
+ |
48 |
+(cherry picked from qtdeclarative 58bae53237417f28eac6d772fa6ecab657f8a73f) |
49 |
+--- |
50 |
+ src/quicktemplates2/qquickcontrol.cpp | 30 +++++++++++++ |
51 |
+ src/quicktemplates2/qquickcontrol_p_p.h | 1 + |
52 |
+ src/quicktemplates2/qquickscrollbar.cpp | 11 +++++ |
53 |
+ tests/auto/controls/data/tst_scrollview.qml | 47 +++++++++++++++++++++ |
54 |
+ 4 files changed, 89 insertions(+) |
55 |
+ |
56 |
+diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp |
57 |
+index bbbd0e622..1f4b47343 100644 |
58 |
+--- a/src/quicktemplates2/qquickcontrol.cpp |
59 |
++++ b/src/quicktemplates2/qquickcontrol.cpp |
60 |
+@@ -845,6 +845,13 @@ void QQuickControlPrivate::executeBackground(bool complete) |
61 |
+ quickCompleteDeferred(q, backgroundName(), background); |
62 |
+ } |
63 |
+ |
64 |
++/* |
65 |
++ \internal |
66 |
++ |
67 |
++ Hides an item that was replaced by a newer one, rather than |
68 |
++ deleting it, as the item is typically created in QML and hence |
69 |
++ we don't own it. |
70 |
++*/ |
71 |
+ void QQuickControlPrivate::hideOldItem(QQuickItem *item) |
72 |
+ { |
73 |
+ if (!item) |
74 |
+@@ -863,6 +870,29 @@ void QQuickControlPrivate::hideOldItem(QQuickItem *item) |
75 |
+ #endif |
76 |
+ } |
77 |
+ |
78 |
++/* |
79 |
++ \internal |
80 |
++ |
81 |
++ Named "unhide" because it's used for cases where an item |
82 |
++ that was previously hidden by \l hideOldItem() wants to be |
83 |
++ shown by a control again, such as a ScrollBar in ScrollView. |
84 |
++*/ |
85 |
++void QQuickControlPrivate::unhideOldItem(QQuickControl *control, QQuickItem *item) |
86 |
++{ |
87 |
++ Q_ASSERT(item); |
88 |
++ qCDebug(lcItemManagement) << "unhiding old item" << item; |
89 |
++ |
90 |
++ item->setVisible(true); |
91 |
++ item->setParentItem(control); |
92 |
++ |
93 |
++#if QT_CONFIG(accessibility) |
94 |
++ // Add the item back in to the accessibility tree. |
95 |
++ QQuickAccessibleAttached *accessible = accessibleAttached(item); |
96 |
++ if (accessible) |
97 |
++ accessible->setIgnored(false); |
98 |
++#endif |
99 |
++} |
100 |
++ |
101 |
+ void QQuickControlPrivate::updateBaselineOffset() |
102 |
+ { |
103 |
+ Q_Q(QQuickControl); |
104 |
+diff --git a/src/quicktemplates2/qquickcontrol_p_p.h b/src/quicktemplates2/qquickcontrol_p_p.h |
105 |
+index 8e979079e..a6e624c91 100644 |
106 |
+--- a/src/quicktemplates2/qquickcontrol_p_p.h |
107 |
++++ b/src/quicktemplates2/qquickcontrol_p_p.h |
108 |
+@@ -173,6 +173,7 @@ public: |
109 |
+ virtual void executeBackground(bool complete = false); |
110 |
+ |
111 |
+ static void hideOldItem(QQuickItem *item); |
112 |
++ static void unhideOldItem(QQuickControl *control, QQuickItem *item); |
113 |
+ |
114 |
+ void updateBaselineOffset(); |
115 |
+ |
116 |
+diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp |
117 |
+index 4e2f509db..1c4b308cd 100644 |
118 |
+--- a/src/quicktemplates2/qquickscrollbar.cpp |
119 |
++++ b/src/quicktemplates2/qquickscrollbar.cpp |
120 |
+@@ -797,6 +797,14 @@ void QQuickScrollBarAttachedPrivate::initHorizontal() |
121 |
+ if (parent && parent == flickable->parentItem()) |
122 |
+ horizontal->stackAfter(flickable); |
123 |
+ |
124 |
++ // If a scroll bar was previously hidden (due to e.g. setting a new contentItem |
125 |
++ // on a ScrollView), we need to make sure that we un-hide it. |
126 |
++ // We don't bother checking if the item is actually the old one, because |
127 |
++ // if it's not, all of the things the function does (setting parent, visibility, etc.) |
128 |
++ // should be no-ops anyway. |
129 |
++ if (auto control = qobject_cast<QQuickControl*>(q_ptr->parent())) |
130 |
++ QQuickControlPrivate::unhideOldItem(control, horizontal); |
131 |
++ |
132 |
+ layoutHorizontal(); |
133 |
+ horizontal->setSize(area->property("widthRatio").toReal()); |
134 |
+ horizontal->setPosition(area->property("xPosition").toReal()); |
135 |
+@@ -818,6 +826,9 @@ void QQuickScrollBarAttachedPrivate::initVertical() |
136 |
+ if (parent && parent == flickable->parentItem()) |
137 |
+ vertical->stackAfter(flickable); |
138 |
+ |
139 |
++ if (auto control = qobject_cast<QQuickControl*>(q_ptr->parent())) |
140 |
++ QQuickControlPrivate::unhideOldItem(control, vertical); |
141 |
++ |
142 |
+ layoutVertical(); |
143 |
+ vertical->setSize(area->property("heightRatio").toReal()); |
144 |
+ vertical->setPosition(area->property("yPosition").toReal()); |
145 |
+diff --git a/tests/auto/controls/data/tst_scrollview.qml b/tests/auto/controls/data/tst_scrollview.qml |
146 |
+index 0e8b08352..cd4931184 100644 |
147 |
+--- a/tests/auto/controls/data/tst_scrollview.qml |
148 |
++++ b/tests/auto/controls/data/tst_scrollview.qml |
149 |
+@@ -576,4 +576,51 @@ TestCase { |
150 |
+ verify(newHorizontalScrollBar.visible) |
151 |
+ verify(!oldHorizontalScrollBar.visible) |
152 |
+ } |
153 |
++ |
154 |
++ Component { |
155 |
++ id: bindingToContentItemAndStandaloneFlickable |
156 |
++ |
157 |
++ Item { |
158 |
++ width: 200 |
159 |
++ height: 200 |
160 |
++ |
161 |
++ property alias scrollView: scrollView |
162 |
++ |
163 |
++ ScrollView { |
164 |
++ id: scrollView |
165 |
++ anchors.fill: parent |
166 |
++ contentItem: listView |
167 |
++ |
168 |
++ property Item someBinding: contentItem |
169 |
++ } |
170 |
++ ListView { |
171 |
++ id: listView |
172 |
++ model: 10 |
173 |
++ delegate: ItemDelegate { |
174 |
++ text: modelData |
175 |
++ width: listView.width |
176 |
++ } |
177 |
++ } |
178 |
++ } |
179 |
++ } |
180 |
++ |
181 |
++ // Tests that scroll bars show up for a ScrollView where |
182 |
++ // - its contentItem is declared as a standalone, separate item |
183 |
++ // - there is a binding to contentItem (which causes a default Flickable to be created) |
184 |
++ function test_bindingToContentItemAndStandaloneFlickable() { |
185 |
++ let root = createTemporaryObject(bindingToContentItemAndStandaloneFlickable, testCase) |
186 |
++ verify(root) |
187 |
++ |
188 |
++ let control = root.scrollView |
189 |
++ let verticalScrollBar = control.ScrollBar.vertical |
190 |
++ let horizontalScrollBar = control.ScrollBar.horizontal |
191 |
++ compare(verticalScrollBar.parent, control) |
192 |
++ compare(horizontalScrollBar.parent, control) |
193 |
++ verify(verticalScrollBar.visible) |
194 |
++ verify(horizontalScrollBar.visible) |
195 |
++ |
196 |
++ mouseDrag(verticalScrollBar, verticalScrollBar.width / 2, verticalScrollBar.height / 2, 0, 50) |
197 |
++ verify(verticalScrollBar.active) |
198 |
++ verify(horizontalScrollBar.active) |
199 |
++ } |
200 |
+ } |
201 |
+-- |
202 |
+GitLab |
203 |
+ |
204 |
|
205 |
diff --git a/dev-qt/qtquickcontrols2/qtquickcontrols2-5.15.5-r1.ebuild b/dev-qt/qtquickcontrols2/qtquickcontrols2-5.15.5-r1.ebuild |
206 |
new file mode 100644 |
207 |
index 000000000000..4da5300374e1 |
208 |
--- /dev/null |
209 |
+++ b/dev-qt/qtquickcontrols2/qtquickcontrols2-5.15.5-r1.ebuild |
210 |
@@ -0,0 +1,37 @@ |
211 |
+# Copyright 1999-2022 Gentoo Authors |
212 |
+# Distributed under the terms of the GNU General Public License v2 |
213 |
+ |
214 |
+EAPI=8 |
215 |
+ |
216 |
+QT5_KDEPATCHSET_REV=1 |
217 |
+inherit qt5-build |
218 |
+ |
219 |
+DESCRIPTION="Set of next generation Qt Quick controls for the Qt5 framework" |
220 |
+ |
221 |
+if [[ ${QT5_BUILD_TYPE} == release ]]; then |
222 |
+ KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86" |
223 |
+fi |
224 |
+ |
225 |
+IUSE="widgets" |
226 |
+ |
227 |
+DEPEND=" |
228 |
+ =dev-qt/qtcore-${QT5_PV}* |
229 |
+ =dev-qt/qtdeclarative-${QT5_PV}* |
230 |
+ =dev-qt/qtgui-${QT5_PV}* |
231 |
+ widgets? ( =dev-qt/qtwidgets-${QT5_PV}* ) |
232 |
+" |
233 |
+RDEPEND="${DEPEND} |
234 |
+ =dev-qt/qtgraphicaleffects-${QT5_PV}* |
235 |
+" |
236 |
+ |
237 |
+PATCHES=( "${FILESDIR}/${P}-QTBUG-104983.patch" ) |
238 |
+ |
239 |
+src_prepare() { |
240 |
+ qt_use_disable_mod widgets widgets \ |
241 |
+ src/imports/platform/platform.pro |
242 |
+ |
243 |
+ qt5-build_src_prepare |
244 |
+ |
245 |
+ # workaround for 0005-Revert-...patch dropping a header |
246 |
+ perl ${QT5_BINDIR}/syncqt.pl -version ${PV} || die |
247 |
+} |