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

Up: xorg-xprop to 1.2.0.
author Christopher Rogers <slaxemulator@gmail.com>
date Sun Nov 14 15:46:44 2010 +0000 (2010-11-14)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/qt4/stuff/fix-scroll-when-last-item-is-removed.patch	Sun Nov 14 15:46:44 2010 +0000
     1.3 @@ -0,0 +1,38 @@
     1.4 +From 6da6b7099d4e0b49329793e4b90703ec3d868048 Mon Sep 17 00:00:00 2001
     1.5 +From: Frank Reininghaus <frank78ac@googlemail.com>
     1.6 +Date: Wed, 22 Sep 2010 10:19:59 +0200
     1.7 +Subject: [PATCH] QTreeView: do not scroll to top if last item is removed
     1.8 +
     1.9 +When the last item is the current item and is removed,
    1.10 +QTreeViewPrivate::updateScrollBars() is called after QTreeViewPrivate's
    1.11 +viewItems member is cleared. This commit makes sure that viewItems is
    1.12 +restored by calling QTreeView::doItemsLayout() in this case, preventing
    1.13 +that the scroll bar range is set to zero temporarily and the view is
    1.14 +scrolled to the top unexpectedly (this was a regression in 4.7.0:
    1.15 +QTBUG-13567).
    1.16 +
    1.17 +Merge-request: 2481
    1.18 +Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
    1.19 +---
    1.20 + src/gui/itemviews/qtreeview.cpp        |    4 ++++
    1.21 + tests/auto/qtreeview/tst_qtreeview.cpp |   22 ++++++++++++++++++++++
    1.22 + 2 files changed, 26 insertions(+), 0 deletions(-)
    1.23 +
    1.24 +diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
    1.25 +index b797776..40b51fe 100644
    1.26 +--- a/src/gui/itemviews/qtreeview.cpp
    1.27 ++++ b/src/gui/itemviews/qtreeview.cpp
    1.28 +@@ -3435,6 +3435,10 @@ void QTreeViewPrivate::updateScrollBars()
    1.29 +     if (!viewportSize.isValid())
    1.30 +         viewportSize = QSize(0, 0);
    1.31 + 
    1.32 ++    if (viewItems.isEmpty()) {
    1.33 ++        q->doItemsLayout();
    1.34 ++    }
    1.35 ++
    1.36 +     int itemsInViewport = 0;
    1.37 +     if (uniformRowHeights) {
    1.38 +         if (defaultItemHeight <= 0)
    1.39 +-- 
    1.40 +1.6.1
    1.41 +