Item views don't handle insert/remove of rows robustly (QTBUG-48870)
This commit is contained in:
parent
9977eae8bc
commit
e52638b345
78
0076-QListView-fix-skipping-indexes-in-selectedIndexes.patch
Normal file
78
0076-QListView-fix-skipping-indexes-in-selectedIndexes.patch
Normal file
@ -0,0 +1,78 @@
|
||||
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 076/122] 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 +-
|
||||
.../widgets/itemviews/qlistview/tst_qlistview.cpp | 28 ++++++++++++++++++++++
|
||||
2 files changed, 29 insertions(+), 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;
|
||||
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
|
||||
index 5b206af..3cf9f7f 100644
|
||||
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
|
||||
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
|
||||
@@ -152,6 +152,7 @@ private slots:
|
||||
void taskQTBUG_39902_mutualScrollBars_data();
|
||||
void taskQTBUG_39902_mutualScrollBars();
|
||||
void horizontalScrollingByVerticalWheelEvents();
|
||||
+ void taskQTBUG_51086_skippingIndexesInSelectedIndexes();
|
||||
};
|
||||
|
||||
// Testing get/set functions
|
||||
@@ -2493,5 +2494,32 @@ void tst_QListView::horizontalScrollingByVerticalWheelEvents()
|
||||
QVERIFY(lv.verticalScrollBar()->value() > vValue);
|
||||
}
|
||||
|
||||
+void tst_QListView::taskQTBUG_51086_skippingIndexesInSelectedIndexes()
|
||||
+{
|
||||
+ // simple way to get access to selectedIndexes()
|
||||
+ class QListViewWithPublicSelectedIndexes : public QListView
|
||||
+ {
|
||||
+ public:
|
||||
+ using QListView::selectedIndexes;
|
||||
+ };
|
||||
+
|
||||
+ QStandardItemModel data(10, 1);
|
||||
+ QItemSelectionModel selections(&data);
|
||||
+ QListViewWithPublicSelectedIndexes list;
|
||||
+ list.setModel(&data);
|
||||
+ list.setSelectionModel(&selections);
|
||||
+
|
||||
+ list.setRowHidden(7, true);
|
||||
+ list.setRowHidden(8, true);
|
||||
+
|
||||
+ for (int i = 0, count = data.rowCount(); i < count; ++i)
|
||||
+ selections.select(data.index(i, 0), QItemSelectionModel::Select);
|
||||
+
|
||||
+ const QModelIndexList indexes = list.selectedIndexes();
|
||||
+
|
||||
+ QVERIFY(!indexes.contains(data.index(7, 0)));
|
||||
+ QVERIFY(!indexes.contains(data.index(8, 0)));
|
||||
+}
|
||||
+
|
||||
QTEST_MAIN(tst_QListView)
|
||||
#include "tst_qlistview.moc"
|
||||
--
|
||||
2.5.0
|
||||
|
@ -44,7 +44,7 @@
|
||||
Summary: Qt5 - QtBase components
|
||||
Name: qt5-qtbase
|
||||
Version: 5.6.0
|
||||
Release: 0.30.%{prerelease}%{?dist}
|
||||
Release: 0.31.%{prerelease}%{?dist}
|
||||
|
||||
# See LGPL_EXCEPTIONS.txt, for exception details
|
||||
License: LGPLv2 with exceptions or GPLv3 with exceptions
|
||||
@ -98,6 +98,9 @@ Patch100: qt5-qtbase-5.6.0-el6-sqrt.patch
|
||||
# https://codereview.qt-project.org/126102/
|
||||
Patch150: moc-get-the-system-defines-from-the-compiler-itself.patch
|
||||
|
||||
# Item views, https://bugreports.qt.io/browse/QTBUG-48870
|
||||
Patch176: 0076-QListView-fix-skipping-indexes-in-selectedIndexes.patch
|
||||
|
||||
# macros, be mindful to keep sync'd with macros.qt5
|
||||
Source10: macros.qt5
|
||||
%define _qt5 %{name}
|
||||
@ -344,6 +347,7 @@ RPM macros for building Qt5 packages.
|
||||
%patch100 -p1 -b .sqrt
|
||||
|
||||
%patch150 -p1 -b .moc_system_defines
|
||||
%patch176 -p1 -b .0076
|
||||
|
||||
## adjust $RPM_OPT_FLAGS
|
||||
# remove -fexceptions
|
||||
@ -930,6 +934,9 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Wed Feb 24 2016 Rex Dieter <rdieter@fedoraproject.org> 5.6.0-0.31.rc
|
||||
- Item views don't handle insert/remove of rows robustly (QTBUG-48870)
|
||||
|
||||
* Tue Feb 23 2016 Helio Chissini de Castro <helio@kde.org> - 5.6.0-0.30.rc
|
||||
- Update to final RC
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user