wok view qt4/stuff/fix-scroll-when-last-item-is-removed.patch @ rev 7647

busybox/init: add rootuuid= support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Dec 14 22:29:55 2010 +0100 (2010-12-14)
parents
children
line source
1 From 6da6b7099d4e0b49329793e4b90703ec3d868048 Mon Sep 17 00:00:00 2001
2 From: Frank Reininghaus <frank78ac@googlemail.com>
3 Date: Wed, 22 Sep 2010 10:19:59 +0200
4 Subject: [PATCH] QTreeView: do not scroll to top if last item is removed
6 When the last item is the current item and is removed,
7 QTreeViewPrivate::updateScrollBars() is called after QTreeViewPrivate's
8 viewItems member is cleared. This commit makes sure that viewItems is
9 restored by calling QTreeView::doItemsLayout() in this case, preventing
10 that the scroll bar range is set to zero temporarily and the view is
11 scrolled to the top unexpectedly (this was a regression in 4.7.0:
12 QTBUG-13567).
14 Merge-request: 2481
15 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
16 ---
17 src/gui/itemviews/qtreeview.cpp | 4 ++++
18 tests/auto/qtreeview/tst_qtreeview.cpp | 22 ++++++++++++++++++++++
19 2 files changed, 26 insertions(+), 0 deletions(-)
21 diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
22 index b797776..40b51fe 100644
23 --- a/src/gui/itemviews/qtreeview.cpp
24 +++ b/src/gui/itemviews/qtreeview.cpp
25 @@ -3435,6 +3435,10 @@ void QTreeViewPrivate::updateScrollBars()
26 if (!viewportSize.isValid())
27 viewportSize = QSize(0, 0);
29 + if (viewItems.isEmpty()) {
30 + q->doItemsLayout();
31 + }
32 +
33 int itemsInViewport = 0;
34 if (uniformRowHeights) {
35 if (defaultItemHeight <= 0)
36 --
37 1.6.1