Item views don't handle insert/remove of rows robustly (QTBUG-48870)

This commit is contained in:
Rex Dieter 2016-02-24 22:04:57 -06:00
parent f1a8d41bb2
commit 04661b7de7
3 changed files with 88 additions and 1 deletions

View File

@ -0,0 +1,47 @@
From 0cfdfcc82ec58b2016f4ab2973343eb85874f27d Mon Sep 17 00:00:00 2001
From: Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
Date: Sun, 11 Oct 2015 15:27:37 +0200
Subject: [PATCH 2/3] QListView: Use correct available size when calculating
scrollbars.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Calculation was working as long as one didn't use per pixel scrolling.
Task-number: QTBUG-48579
Change-Id: Ie02e28b008c5c81ed45d7dd17fed96148c23b598
Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: David Faure <david.faure@kdab.com>
---
src/widgets/itemviews/qlistview.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index f3fd3e7..8257944 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -1846,8 +1846,7 @@ void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
- const QSize viewportSize(viewport()->width() + (qq->verticalScrollBar()->maximum() > 0 ? qq->verticalScrollBar()->width() : 0),
- viewport()->height() + (qq->horizontalScrollBar()->maximum() > 0 ? qq->horizontalScrollBar()->height() : 0));
+ const QSize viewportSize = qq->contentsRect().size();
bool verticalWantsToShow = contentsSize.height() > viewportSize.height();
bool horizontalWantsToShow;
@@ -1877,8 +1876,7 @@ void QCommonListViewBase::updateVerticalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
- const QSize viewportSize(viewport()->width() + (qq->verticalScrollBar()->maximum() > 0 ? qq->verticalScrollBar()->width() : 0),
- viewport()->height() + (qq->horizontalScrollBar()->maximum() > 0 ? qq->horizontalScrollBar()->height() : 0));
+ const QSize viewportSize = qq->contentsRect().size();
bool horizontalWantsToShow = contentsSize.width() > viewportSize.width();
bool verticalWantsToShow;
--
2.5.0

View File

@ -0,0 +1,32 @@
From a3b8e355fc17783a5d4badfb9ad50247655000cd Mon Sep 17 00:00:00 2001
From: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
Date: Fri, 12 Feb 2016 15:31:07 +0300
Subject: [PATCH 3/3] QListView: fix skipping indexes in selectedIndexes().
Remove spurious increment of i.
Task-number: QTBUG-51086
Change-Id: I4307a6728de1e7f25c8afa31fe2066f92373f3fc
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
---
src/widgets/itemviews/qlistview.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 9c79509..a17d89e 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -1437,7 +1437,7 @@ QModelIndexList QListView::selectedIndexes() const
return QModelIndexList();
QModelIndexList viewSelected = d->selectionModel->selectedIndexes();
- for (int i = 0; i < viewSelected.count(); ++i) {
+ for (int i = 0; i < viewSelected.count();) {
const QModelIndex &index = viewSelected.at(i);
if (!isIndexHidden(index) && index.parent() == d->root && index.column() == d->column)
++i;
--
2.5.0

View File

@ -44,7 +44,7 @@
Summary: Qt5 - QtBase components
Name: qt5-qtbase
Version: 5.5.1
Release: 11%{?dist}
Release: 12%{?dist}
# See LGPL_EXCEPTIONS.txt, for exception details
License: LGPLv2 with exceptions or GPLv3 with exceptions
@ -101,6 +101,9 @@ Patch100: qtbase-opensource-src-5.4.0-QTBUG-43057.patch
# Fix for https://bugreports.qt.io/browse/QTBUG-4246
Patch101: qt5-qtbase-qlineedit-fix-visibility-of-side-widgets.patch
Patch102: 0002-QListView-Use-correct-available-size-when-calculatin.patch
Patch103: 0003-QListView-fix-skipping-indexes-in-selectedIndexes.patch
# macros, be mindful to keep sync'd with macros.qt5
Source1: macros.qt5
%define _qt5 %{name}
@ -380,6 +383,8 @@ rm -fv mkspecs/linux-g++*/qmake.conf.multilib-optflags
%endif
%patch101 -p1 -b .qlineedit-fix-visibility-of-side-widgets
%patch102 -p1 -b .0002
%patch103 -p1 -b .0003
# drop -fexceptions from $RPM_OPT_FLAGS
RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed 's|-fexceptions||g'`
@ -946,6 +951,9 @@ fi
%changelog
* Wed Feb 24 2016 Rex Dieter <rdieter@fedoraproject.org> 5.5.1-12
- Item views don't handle insert/remove of rows robustly (QTBUG-48870)
* Fri Jan 15 2016 Than Ngo <than@redhat.com> - 5.5.1-11
- Crash in QXcbWindow::setParent() due to NULL xcbScreen (QTBUG-50081, #1291003)
- enable -qt-xcb to fix non-US keys under VNC (#1295713)