Hello community, here is the log from the commit of package kitemmodels for openSUSE:Factory checked in at 2016-08-29 15:05:25 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kitemmodels (Old) and /work/SRC/openSUSE:Factory/.kitemmodels.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kitemmodels" Changes: -------- --- /work/SRC/openSUSE:Factory/kitemmodels/kitemmodels.changes 2016-07-15 12:36:03.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.kitemmodels.new/kitemmodels.changes 2016-08-29 15:05:52.000000000 +0200 @@ -1,0 +2,15 @@ +Sun Aug 7 21:54:21 UTC 2016 - hrvoje.sen...@gmail.com + +- Update to 5.25.0 + * Qt >= 5.5 is now required + * KRearrangeColumnsProxyModel: fix assert in index(0, 0) + on empty model + * Fix KDescendantsProxyModel::setSourceModel() not + clearing internal caches + * KRecursiveFilterProxyModel: fix QSFPM corruption due to + filtering out rowsRemoved signal (kde#349789) + * KExtraColumnsProxyModel: implement hasChildren() + * For more details please see: + https://www.kde.org/announcements/kde-frameworks-5.25.0.php + +------------------------------------------------------------------- Old: ---- kitemmodels-5.24.0.tar.xz New: ---- kitemmodels-5.25.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kitemmodels.spec ++++++ --- /var/tmp/diff_new_pack.Q7LFyX/_old 2016-08-29 15:05:55.000000000 +0200 +++ /var/tmp/diff_new_pack.Q7LFyX/_new 2016-08-29 15:05:55.000000000 +0200 @@ -17,15 +17,15 @@ %define lname libKF5ItemModels5 -%define _tar_path 5.24 +%define _tar_path 5.25 Name: kitemmodels -Version: 5.24.0 +Version: 5.25.0 Release: 0 BuildRequires: cmake >= 2.8.12 BuildRequires: extra-cmake-modules >= %{_tar_path} BuildRequires: fdupes BuildRequires: kf5-filesystem -BuildRequires: cmake(Qt5Core) >= 5.4.0 +BuildRequires: cmake(Qt5Core) >= 5.5.0 Summary: Set of item models extending the Qt model-view framework License: LGPL-2.1+ Group: System/GUI/KDE @@ -50,7 +50,7 @@ Group: Development/Libraries/KDE Requires: %lname = %{version} Requires: extra-cmake-modules -Requires: cmake(Qt5Core) >= 5.4.0 +Requires: cmake(Qt5Core) >= 5.5.0 %description devel KItemModels provides a set of item models extending the Qt model-view framework. ++++++ kitemmodels-5.24.0.tar.xz -> kitemmodels-5.25.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.24.0/CMakeLists.txt new/kitemmodels-5.25.0/CMakeLists.txt --- old/kitemmodels-5.24.0/CMakeLists.txt 2016-07-03 11:49:44.000000000 +0200 +++ new/kitemmodels-5.25.0/CMakeLists.txt 2016-08-07 13:02:02.000000000 +0200 @@ -3,7 +3,7 @@ project(KItemModels) include(FeatureSummary) -find_package(ECM 5.24.0 NO_MODULE) +find_package(ECM 5.25.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) @@ -14,7 +14,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) -set(REQUIRED_QT_VERSION 5.4.0) +set(REQUIRED_QT_VERSION 5.5.0) find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) @@ -23,7 +23,7 @@ include(ECMSetupVersion) include(ECMGenerateHeaders) -set(KF5_VERSION "5.24.0") # handled by release scripts +set(KF5_VERSION "5.25.0") # handled by release scripts ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX KITEMMODELS VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kitemmodels_version.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.24.0/autotests/CMakeLists.txt new/kitemmodels-5.25.0/autotests/CMakeLists.txt --- old/kitemmodels-5.24.0/autotests/CMakeLists.txt 2016-07-03 11:49:44.000000000 +0200 +++ new/kitemmodels-5.25.0/autotests/CMakeLists.txt 2016-08-07 13:02:02.000000000 +0200 @@ -17,6 +17,7 @@ ecm_add_tests( kconcatenaterowsproxymodeltest.cpp kdescendantsproxymodel_smoketest.cpp + kdescendantsproxymodeltest.cpp kextracolumnsproxymodeltest.cpp klinkitemselectionmodeltest.cpp testmodelqueuedconnections.cpp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.24.0/autotests/kdescendantsproxymodeltest.cpp new/kitemmodels-5.25.0/autotests/kdescendantsproxymodeltest.cpp --- old/kitemmodels-5.24.0/autotests/kdescendantsproxymodeltest.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kitemmodels-5.25.0/autotests/kdescendantsproxymodeltest.cpp 2016-08-07 13:02:02.000000000 +0200 @@ -0,0 +1,91 @@ +/* + Copyright (C) 2016 Sune Vuorela <s...@debian.org> + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or (at your + option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + +#include "kdescendantsproxymodel.h" + +#include <QStandardItemModel> +#include <QTest> + +class tst_KDescendantProxyModel : public QObject +{ + Q_OBJECT + QAbstractItemModel *createTree(const QString &prefix) + { + QStandardItemModel *model = new QStandardItemModel(); + for (int i = 0; i < 2 ; i++) { + QStandardItem *item = new QStandardItem(); + item->setData(QString(prefix + QString::number(i)), Qt::DisplayRole); + for (int j = 0 ; j < 2 ; j++) { + QStandardItem *child = new QStandardItem(); + child->setData(QString(prefix + QString::number(i) + "-" + QString::number(j)), Qt::DisplayRole); + item->appendRow(child); + } + model->appendRow(item); + } + return model; + } +private Q_SLOTS: + void testResetModelContent(); +}; + +/// Tests that replacing the source model results in data getting changed +void tst_KDescendantProxyModel::testResetModelContent() +{ + auto model1 = createTree("FirstModel"); + KDescendantsProxyModel proxy; + proxy.setSourceModel(model1); + QCOMPARE(proxy.rowCount(), 6); + + { + QStringList results = QStringList() + << "FirstModel0" + << "FirstModel0-0" + << "FirstModel0-1" + << "FirstModel1" + << "FirstModel1-0" + << "FirstModel1-1"; + QCOMPARE(proxy.rowCount(), results.count()); + for (int i = 0 ; i < proxy.rowCount() ; i++) { + QCOMPARE(proxy.index(i, 0).data(Qt::DisplayRole).toString(), results[i]); + } + } + auto model2 = createTree("SecondModel"); + { + proxy.setSourceModel(model2); + QStringList results = QStringList() + << "SecondModel0" + << "SecondModel0-0" + << "SecondModel0-1" + << "SecondModel1" + << "SecondModel1-0" + << "SecondModel1-1"; + QCOMPARE(proxy.rowCount(), results.count()); + for (int i = 0 ; i < proxy.rowCount() ; i++) { + QCOMPARE(proxy.index(i, 0).data(Qt::DisplayRole).toString(), results[i]); + } + } + + delete model2; + delete model1; +} + +QTEST_MAIN(tst_KDescendantProxyModel) + +#include "kdescendantsproxymodeltest.moc" + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.24.0/autotests/kextracolumnsproxymodeltest.cpp new/kitemmodels-5.25.0/autotests/kextracolumnsproxymodeltest.cpp --- old/kitemmodels-5.24.0/autotests/kextracolumnsproxymodeltest.cpp 2016-07-03 11:49:44.000000000 +0200 +++ new/kitemmodels-5.25.0/autotests/kextracolumnsproxymodeltest.cpp 2016-08-07 13:02:02.000000000 +0200 @@ -175,6 +175,12 @@ QCOMPARE(pm.index(0, 0).sibling(0, 4).column(), 4); QCOMPARE(pm.index(0, 4).sibling(0, 1).column(), 1); + QCOMPARE(pm.buddy(pm.index(0, 0)), pm.index(0, 0)); + QCOMPARE(pm.buddy(pm.index(0, 4)), pm.index(0, 4)); + + QVERIFY(pm.hasChildren(pm.index(0, 0))); + QVERIFY(!pm.hasChildren(pm.index(0, 4))); + QVERIFY(!pm.canFetchMore(QModelIndex())); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.24.0/autotests/krearrangecolumnsproxymodeltest.cpp new/kitemmodels-5.25.0/autotests/krearrangecolumnsproxymodeltest.cpp --- old/kitemmodels-5.24.0/autotests/krearrangecolumnsproxymodeltest.cpp 2016-07-03 11:49:44.000000000 +0200 +++ new/kitemmodels-5.25.0/autotests/krearrangecolumnsproxymodeltest.cpp 2016-08-07 13:02:02.000000000 +0200 @@ -78,6 +78,23 @@ QCOMPARE(pm.columnCount(), 0); } + void shouldShowNothingIfNoRows() + { + // Given a rearrange-columns proxy + KRearrangeColumnsProxyModel pm; + pm.setSourceColumns(QVector<int>() << 2 << 3 << 1 << 0); + + // When using that proxy on top of an empty source model + QStandardItemModel sourceModel; + sourceModel.setColumnCount(4); + pm.setSourceModel(&sourceModel); + + // Then the proxy should show nothing + QCOMPARE(pm.rowCount(), 0); + QCOMPARE(pm.columnCount(), 4); + QCOMPARE(pm.index(0, 0), pm.index(0, 0)); // like QAbstractItemView::setModel does in a Q_ASSERT_X + } + void shouldRearrangeColumns() { // Given a rearrange-columns proxy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.24.0/autotests/krecursivefilterproxymodeltest.cpp new/kitemmodels-5.25.0/autotests/krecursivefilterproxymodeltest.cpp --- old/kitemmodels-5.24.0/autotests/krecursivefilterproxymodeltest.cpp 2016-07-03 11:49:44.000000000 +0200 +++ new/kitemmodels-5.25.0/autotests/krecursivefilterproxymodeltest.cpp 2016-08-07 13:02:02.000000000 +0200 @@ -551,9 +551,11 @@ const QStringList remove1_1_1 = (QStringList() << QStringLiteral("rowsAboutToBeRemoved(1.1.1)") << QStringLiteral("rowsRemoved(1.1.1)")); - QTest::newRow("toplevel") << "[1*]" << "[1*]" << "1" << "" + QTest::newRow("toplevel") << "[1* 2* 3*]" << "[1* 2* 3*]" << "1" << "[2* 3*]" << (QStringList() << QStringLiteral("rowsAboutToBeRemoved(1)") << QStringLiteral("rowsRemoved(1)")); + QTest::newRow("remove_hidden") << "[1 2* 3*]" << "[2* 3*]" << "1" << "[2* 3*]" << QStringList(); + QTest::newRow("parent_hidden") << "[1[1.1[1.1.1]]]" << "" << "1.1.1" << "" << QStringList(); QTest::newRow("child_hidden") << "[1[1.1*[1.1.1]]]" << "[1[1.1*]]" << "1.1.1" << "[1[1.1*]]" << QStringList(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.24.0/autotests/test_model_helpers.h new/kitemmodels-5.25.0/autotests/test_model_helpers.h --- old/kitemmodels-5.24.0/autotests/test_model_helpers.h 2016-07-03 11:49:44.000000000 +0200 +++ new/kitemmodels-5.25.0/autotests/test_model_helpers.h 2016-08-07 13:02:02.000000000 +0200 @@ -20,6 +20,7 @@ #include <QString> #include <QStandardItem> +#include <QSignalSpy> namespace TestModelHelpers { @@ -66,7 +67,7 @@ } QString str; for (int i = 0; i < spy.count(); ++i) { - str += spy.at(i).at(1).toString() + ',' + spy.at(i).at(2).toString(); + str += spy.at(i).at(1).toString() + QLatin1Char(',') + spy.at(i).at(2).toString(); if (i + 1 < spy.count()) { str += QLatin1Char(';'); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.24.0/src/kdescendantsproxymodel.cpp new/kitemmodels-5.25.0/src/kdescendantsproxymodel.cpp --- old/kitemmodels-5.24.0/src/kdescendantsproxymodel.cpp 2016-07-03 11:49:44.000000000 +0200 +++ new/kitemmodels-5.25.0/src/kdescendantsproxymodel.cpp 2016-08-07 13:02:02.000000000 +0200 @@ -246,9 +246,11 @@ void KDescendantsProxyModel::setSourceModel(QAbstractItemModel *_sourceModel) { + Q_D(KDescendantsProxyModel); + beginResetModel(); - static const char *modelSignals[] = { + static const char *const modelSignals[] = { SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), SIGNAL(rowsInserted(QModelIndex,int,int)), SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), @@ -262,7 +264,7 @@ SIGNAL(layoutChanged()), SIGNAL(destroyed()) }; - static const char *proxySlots[] = { + static const char *const proxySlots[] = { SLOT(sourceRowsAboutToBeInserted(QModelIndex,int,int)), SLOT(sourceRowsInserted(QModelIndex,int,int)), SLOT(sourceRowsAboutToBeRemoved(QModelIndex,int,int)), @@ -291,6 +293,11 @@ } } + resetInternalData(); + if (_sourceModel && _sourceModel->hasChildren()) { + d->synchronousMappingRefresh(); + } + endResetModel(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.24.0/src/kextracolumnsproxymodel.cpp new/kitemmodels-5.25.0/src/kextracolumnsproxymodel.cpp --- old/kitemmodels-5.24.0/src/kextracolumnsproxymodel.cpp 2016-07-03 11:49:44.000000000 +0200 +++ new/kitemmodels-5.25.0/src/kextracolumnsproxymodel.cpp 2016-08-07 13:02:02.000000000 +0200 @@ -121,6 +121,15 @@ return QIdentityProxyModel::mapToSource(proxyIndex); } +QModelIndex KExtraColumnsProxyModel::buddy(const QModelIndex &proxyIndex) const +{ + const int column = proxyIndex.column(); + if (column >= sourceModel()->columnCount()) { + return proxyIndex; + } + return QIdentityProxyModel::buddy(proxyIndex); +} + QModelIndex KExtraColumnsProxyModel::sibling(int row, int column, const QModelIndex &idx) const { if (row == idx.row() && column == idx.column()) { @@ -199,6 +208,14 @@ return sourceModel()->flags(mapToSource(index)); } +bool KExtraColumnsProxyModel::hasChildren(const QModelIndex &index) const +{ + if (index.column() > 0) { + return false; + } + return QIdentityProxyModel::hasChildren(index); +} + QVariant KExtraColumnsProxyModel::headerData(int section, Qt::Orientation orientation, int role) const { Q_D(const KExtraColumnsProxyModel); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.24.0/src/kextracolumnsproxymodel.h new/kitemmodels-5.25.0/src/kextracolumnsproxymodel.h --- old/kitemmodels-5.24.0/src/kextracolumnsproxymodel.h 2016-07-03 11:49:44.000000000 +0200 +++ new/kitemmodels-5.25.0/src/kextracolumnsproxymodel.h 2016-08-07 13:02:02.000000000 +0200 @@ -81,14 +81,16 @@ * This method is called by data() for extra columns. * Reimplement this method to return the data for the extra columns. * - * @param parent the parent model index (only useful in tree models) - * @param row the row number for which the model is querying for data (child of @p parent, if set) + * @param parent the parent model index in the proxy model (only useful in tree models) + * @param row the row number for which the proxy model is querying for data (child of @p parent, if set) * @param extraColumn the number of the extra column, starting at 0 (this doesn't require knowing how many columns the source model has) * @param role the role being queried * @return the data at @p row and @p extraColumn */ virtual QVariant extraColumnData(const QModelIndex &parent, int row, int extraColumn, int role = Qt::DisplayRole) const = 0; + // KF6 TODO: add extraColumnFlags() virtual method + /** * This method is called by setData() for extra columns. * Reimplement this method to set the data for the extra columns, if editing is supported. @@ -131,8 +133,12 @@ /// @reimp QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE; /// @reimp + QModelIndex buddy(const QModelIndex &index) const Q_DECL_OVERRIDE; + /// @reimp Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE; /// @reimp + bool hasChildren(const QModelIndex &index) const Q_DECL_OVERRIDE; + /// @reimp QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; /// @reimp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.24.0/src/krearrangecolumnsproxymodel.cpp new/kitemmodels-5.25.0/src/krearrangecolumnsproxymodel.cpp --- old/kitemmodels-5.24.0/src/krearrangecolumnsproxymodel.cpp 2016-07-03 11:49:44.000000000 +0200 +++ new/kitemmodels-5.25.0/src/krearrangecolumnsproxymodel.cpp 2016-08-07 13:02:02.000000000 +0200 @@ -69,7 +69,9 @@ // Find the child in the source model, we need its internal pointer const QModelIndex sourceIndex = sourceModel()->index(row, sourceColumnForProxyColumn(column), sourceParent); - Q_ASSERT(sourceIndex.isValid()); + if (!sourceIndex.isValid()) { + return QModelIndex(); + } return createIndex(row, column, sourceIndex.internalPointer()); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.24.0/src/krecursivefilterproxymodel.cpp new/kitemmodels-5.25.0/src/krecursivefilterproxymodel.cpp --- old/kitemmodels-5.24.0/src/krecursivefilterproxymodel.cpp 2016-07-03 11:49:44.000000000 +0200 +++ new/kitemmodels-5.25.0/src/krecursivefilterproxymodel.cpp 2016-08-07 13:02:02.000000000 +0200 @@ -47,7 +47,6 @@ public: KRecursiveFilterProxyModelPrivate(KRecursiveFilterProxyModel *model) : q_ptr(model), - ignoreRemove(false), completeInsert(false) { qRegisterMetaType<QModelIndex>("QModelIndex"); @@ -146,7 +145,6 @@ QModelIndex lastFilteredOutAscendant(const QModelIndex &index); - bool ignoreRemove; bool completeInsert; QModelIndex lastHiddenAscendantForInsert; }; @@ -230,21 +228,6 @@ void KRecursiveFilterProxyModelPrivate::sourceRowsAboutToBeRemoved(const QModelIndex &source_parent, int start, int end) { - Q_Q(KRecursiveFilterProxyModel); - - bool accepted = false; - for (int row = start; row <= end; ++row) { - if (q->filterAcceptsRow(row, source_parent)) { - accepted = true; - break; - } - } - if (!accepted) { - // All removed rows are already filtered out. We don't care about the signal. - ignoreRemove = true; - return; - } - invokeRowsAboutToBeRemoved(source_parent, start, end); } @@ -252,11 +235,6 @@ { Q_Q(KRecursiveFilterProxyModel); - if (ignoreRemove) { - ignoreRemove = false; - return; - } - invokeRowsRemoved(source_parent, start, end); // Find out if removing this visible row means that some ascendant @@ -301,7 +279,8 @@ Q_ASSERT(source_index.isValid()); bool accepted = false; - for (int row = 0, rows = sourceModel()->rowCount(source_index); row < rows; ++row) { + const int numChildren = sourceModel()->rowCount(source_index); + for (int row = 0, rows = numChildren; row < rows; ++row) { if (filterAcceptsRow(row, source_index)) { accepted = true; break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.24.0/src/kselectionproxymodel.cpp new/kitemmodels-5.25.0/src/kselectionproxymodel.cpp --- old/kitemmodels-5.24.0/src/kselectionproxymodel.cpp 2016-07-03 11:49:44.000000000 +0200 +++ new/kitemmodels-5.25.0/src/kselectionproxymodel.cpp 2016-08-07 13:02:02.000000000 +0200 @@ -2103,7 +2103,7 @@ beginResetModel(); d->m_resetting = true; - static const char *modelSignals[] = { + static const char *const modelSignals[] = { SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), SIGNAL(rowsInserted(QModelIndex,int,int)), SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), @@ -2117,7 +2117,7 @@ SIGNAL(layoutChanged()), SIGNAL(destroyed()) }; - static const char *proxySlots[] = { + static const char *const proxySlots[] = { SLOT(sourceRowsAboutToBeInserted(QModelIndex,int,int)), SLOT(sourceRowsInserted(QModelIndex,int,int)), SLOT(sourceRowsAboutToBeRemoved(QModelIndex,int,int)),