From 04661b7de7cefbe868457a6473947a79789dde8b Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Wed, 24 Feb 2016 22:04:57 -0600 Subject: [PATCH] Item views don't handle insert/remove of rows robustly (QTBUG-48870) --- ...rrect-available-size-when-calculatin.patch | 47 +++++++++++++++++++ ...-skipping-indexes-in-selectedIndexes.patch | 32 +++++++++++++ qt5-qtbase.spec | 10 +++- 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 0002-QListView-Use-correct-available-size-when-calculatin.patch create mode 100644 0003-QListView-fix-skipping-indexes-in-selectedIndexes.patch diff --git a/0002-QListView-Use-correct-available-size-when-calculatin.patch b/0002-QListView-Use-correct-available-size-when-calculatin.patch new file mode 100644 index 0000000..6c0c4cd --- /dev/null +++ b/0002-QListView-Use-correct-available-size-when-calculatin.patch @@ -0,0 +1,47 @@ +From 0cfdfcc82ec58b2016f4ab2973343eb85874f27d Mon Sep 17 00:00:00 2001 +From: Christoph Schleifenbaum +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 +Reviewed-by: Friedemann Kleint +Reviewed-by: David Faure +--- + 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 + diff --git a/0003-QListView-fix-skipping-indexes-in-selectedIndexes.patch b/0003-QListView-fix-skipping-indexes-in-selectedIndexes.patch new file mode 100644 index 0000000..8b5e65e --- /dev/null +++ b/0003-QListView-fix-skipping-indexes-in-selectedIndexes.patch @@ -0,0 +1,32 @@ +From a3b8e355fc17783a5d4badfb9ad50247655000cd Mon Sep 17 00:00:00 2001 +From: Anton Kudryavtsev +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 +Reviewed-by: Oswald Buddenhagen +Reviewed-by: Marc Mutz +--- + 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 + diff --git a/qt5-qtbase.spec b/qt5-qtbase.spec index a463ffb..3d30287 100644 --- a/qt5-qtbase.spec +++ b/qt5-qtbase.spec @@ -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 5.5.1-12 +- Item views don't handle insert/remove of rows robustly (QTBUG-48870) + * Fri Jan 15 2016 Than Ngo - 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)