[qt] apply upstream patch to fix QTreeView-regression
Than Ngo
than at fedoraproject.org
Mon Sep 27 10:38:59 UTC 2010
commit 79a460b19786db9fe27a20bbda04fbecf53ff1b8
Author: Than Ngo <than at redhat.com>
Date: Mon Sep 27 12:38:25 2010 +0200
apply upstream patch to fix QTreeView-regression
...pensource-src-4.7.0-QTBUG-13567-QTreeView.patch | 77 ++++++++++++++++++++
qt.spec | 7 ++-
2 files changed, 83 insertions(+), 1 deletions(-)
---
diff --git a/qt-everywhere-opensource-src-4.7.0-QTBUG-13567-QTreeView.patch b/qt-everywhere-opensource-src-4.7.0-QTBUG-13567-QTreeView.patch
new file mode 100644
index 0000000..2772fcb
--- /dev/null
+++ b/qt-everywhere-opensource-src-4.7.0-QTBUG-13567-QTreeView.patch
@@ -0,0 +1,77 @@
+From 6da6b7099d4e0b49329793e4b90703ec3d868048 Mon Sep 17 00:00:00 2001
+From: Frank Reininghaus <frank78ac at googlemail.com>
+Date: Wed, 22 Sep 2010 10:19:59 +0200
+Subject: [PATCH] QTreeView: do not scroll to top if last item is removed
+
+When the last item is the current item and is removed,
+QTreeViewPrivate::updateScrollBars() is called after QTreeViewPrivate's
+viewItems member is cleared. This commit makes sure that viewItems is
+restored by calling QTreeView::doItemsLayout() in this case, preventing
+that the scroll bar range is set to zero temporarily and the view is
+scrolled to the top unexpectedly (this was a regression in 4.7.0:
+QTBUG-13567).
+
+Merge-request: 2481
+Reviewed-by: Olivier Goffart <olivier.goffart at nokia.com>
+---
+ src/gui/itemviews/qtreeview.cpp | 4 ++++
+ tests/auto/qtreeview/tst_qtreeview.cpp | 22 ++++++++++++++++++++++
+ 2 files changed, 26 insertions(+), 0 deletions(-)
+
+diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
+index b797776..40b51fe 100644
+--- a/src/gui/itemviews/qtreeview.cpp
++++ b/src/gui/itemviews/qtreeview.cpp
+@@ -3435,6 +3435,10 @@ void QTreeViewPrivate::updateScrollBars()
+ if (!viewportSize.isValid())
+ viewportSize = QSize(0, 0);
+
++ if (viewItems.isEmpty()) {
++ q->doItemsLayout();
++ }
++
+ int itemsInViewport = 0;
+ if (uniformRowHeights) {
+ if (defaultItemHeight <= 0)
+diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
+index 7e2e800..c7b53e9 100644
+--- a/tests/auto/qtreeview/tst_qtreeview.cpp
++++ b/tests/auto/qtreeview/tst_qtreeview.cpp
+@@ -240,6 +240,7 @@ private slots:
+ void taskQTBUG_6450_selectAllWith1stColumnHidden();
+ void taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint();
+ void taskQTBUG_11466_keyboardNavigationRegression();
++ void taskQTBUG_13567_removeLastItemRegression();
+ };
+
+ class QtTestModel: public QAbstractItemModel
+@@ -3910,5 +3911,26 @@ void tst_QTreeView::taskQTBUG_11466_keyboardNavigationRegression()
+ QTRY_COMPARE(treeView.currentIndex(), treeView.selectionModel()->selection().indexes().first());
+ }
+
++void tst_QTreeView::taskQTBUG_13567_removeLastItemRegression()
++{
++ QtTestModel model(200, 1);
++
++ QTreeView view;
++ view.setSelectionMode(QAbstractItemView::ExtendedSelection);
++ view.setModel(&model);
++ view.show();
++ QTest::qWaitForWindowShown(&view);
++
++ view.scrollToBottom();
++ QTest::qWait(10);
++ CHECK_VISIBLE(199, 0);
++
++ view.setCurrentIndex(model.index(199, 0));
++ model.removeLastRow();
++ QTest::qWait(10);
++ QCOMPARE(view.currentIndex(), model.index(198, 0));
++ CHECK_VISIBLE(198, 0);
++}
++
+ QTEST_MAIN(tst_QTreeView)
+ #include "tst_qtreeview.moc"
+--
+1.6.1
+
diff --git a/qt.spec b/qt.spec
index 260dcbd..ec52738 100644
--- a/qt.spec
+++ b/qt.spec
@@ -18,7 +18,7 @@ Summary: Qt toolkit
Name: qt
Epoch: 1
Version: 4.7.0
-Release: 3%{?dist}
+Release: 4%{?dist}
# See LGPL_EXCEPTIONS.txt, LICENSE.GPL3, respectively, for exception details
License: (LGPLv2 with exceptions or GPLv3 with exceptions) and ASL 2.0 and BSD and FTL and MIT
@@ -82,6 +82,7 @@ Patch62: qt-4.6.3-indic-rendering-bz636399.patch
# security patches
# upstream patches
+Patch100: qt-everywhere-opensource-src-4.7.0-QTBUG-13567-QTreeView.patch
# kde-qt git patches
Patch202: 0002-This-patch-makes-override-redirect-windows-popup-men.patch
@@ -435,6 +436,7 @@ Qt libraries used for drawing widgets and OpenGL items.
# security fixes
# upstream patches
+%patch100 -p1 -b .QTBUG-13567-QTreeView
# kde-qt branch
%if 0%{?kde_qt}
@@ -1095,6 +1097,9 @@ fi
%changelog
+* Mon Sep 27 2010 Than Ngo <than at redhat.com> - 4.7.0-4
+- apply upstream patch to fix QTreeView-regression
+
* Thu Sep 23 2010 Than Ngo <than at redhat.com> - 4.7.0-3
- fix typo in license
More information about the scm-commits
mailing list