Hello community, here is the log from the commit of package kitemmodels for openSUSE:Factory checked in at 2016-09-14 23:24:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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-08-29 15:05:52.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.kitemmodels.new/kitemmodels.changes 2016-09-14 23:24:52.000000000 +0200 @@ -1,0 +2,7 @@ +Tue Sep 6 20:51:08 UTC 2016 - [email protected] + +- Update to 5.26.0 + * For more details please see: + https://www.kde.org/announcements/kde-frameworks-5.26.0.php + +------------------------------------------------------------------- Old: ---- kitemmodels-5.25.0.tar.xz New: ---- kitemmodels-5.26.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kitemmodels.spec ++++++ --- /var/tmp/diff_new_pack.rLxnfC/_old 2016-09-14 23:24:53.000000000 +0200 +++ /var/tmp/diff_new_pack.rLxnfC/_new 2016-09-14 23:24:53.000000000 +0200 @@ -17,9 +17,9 @@ %define lname libKF5ItemModels5 -%define _tar_path 5.25 +%define _tar_path 5.26 Name: kitemmodels -Version: 5.25.0 +Version: 5.26.0 Release: 0 BuildRequires: cmake >= 2.8.12 BuildRequires: extra-cmake-modules >= %{_tar_path} ++++++ kitemmodels-5.25.0.tar.xz -> kitemmodels-5.26.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.25.0/CMakeLists.txt new/kitemmodels-5.26.0/CMakeLists.txt --- old/kitemmodels-5.25.0/CMakeLists.txt 2016-08-07 13:02:02.000000000 +0200 +++ new/kitemmodels-5.26.0/CMakeLists.txt 2016-09-06 00:36:46.000000000 +0200 @@ -3,7 +3,7 @@ project(KItemModels) include(FeatureSummary) -find_package(ECM 5.25.0 NO_MODULE) +find_package(ECM 5.26.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) @@ -23,7 +23,7 @@ include(ECMSetupVersion) include(ECMGenerateHeaders) -set(KF5_VERSION "5.25.0") # handled by release scripts +set(KF5_VERSION "5.26.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.25.0/autotests/kdescendantsproxymodeltest.cpp new/kitemmodels-5.26.0/autotests/kdescendantsproxymodeltest.cpp --- old/kitemmodels-5.25.0/autotests/kdescendantsproxymodeltest.cpp 2016-08-07 13:02:02.000000000 +0200 +++ new/kitemmodels-5.26.0/autotests/kdescendantsproxymodeltest.cpp 2016-09-06 00:36:46.000000000 +0200 @@ -21,6 +21,7 @@ #include <QStandardItemModel> #include <QTest> +#include <QSignalSpy> class tst_KDescendantProxyModel : public QObject { @@ -42,6 +43,9 @@ } private Q_SLOTS: void testResetModelContent(); + void testChangeSeparator(); + void testChangeInvisibleSeparator(); + void testRemoveSeparator(); }; /// Tests that replacing the source model results in data getting changed @@ -85,6 +89,132 @@ delete model1; } +/// tests that change separator works, as well as emits the relevant data changed signals +void tst_KDescendantProxyModel::testChangeSeparator() +{ + auto model1 = createTree("FirstModel"); + KDescendantsProxyModel proxy; + proxy.setSourceModel(model1); + proxy.setDisplayAncestorData(true); + QSignalSpy dataChangedSpy(&proxy, &QAbstractItemModel::dataChanged); + QCOMPARE(proxy.rowCount(), 6); + { + QStringList results = QStringList() + << "FirstModel0" + << "FirstModel0 / FirstModel0-0" + << "FirstModel0 / FirstModel0-1" + << "FirstModel1" + << "FirstModel1 / FirstModel1-0" + << "FirstModel1 / 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]); + } + } + proxy.setAncestorSeparator("LOL"); + QCOMPARE(dataChangedSpy.count(),1); + { + QStringList results = QStringList() + << "FirstModel0" + << "FirstModel0LOLFirstModel0-0" + << "FirstModel0LOLFirstModel0-1" + << "FirstModel1" + << "FirstModel1LOLFirstModel1-0" + << "FirstModel1LOLFirstModel1-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 model1; +} + +/// tests that change seperator that is not shown does not change the content and does not +/// emit data changed signals, since the data isn't changed +void tst_KDescendantProxyModel::testChangeInvisibleSeparator() +{ + auto model1 = createTree("FirstModel"); + KDescendantsProxyModel proxy; + proxy.setSourceModel(model1); + QSignalSpy dataChangedSpy(&proxy, &QAbstractItemModel::dataChanged); + 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]); + } + } + proxy.setAncestorSeparator("LOL"); + QCOMPARE(dataChangedSpy.count(),0); + { + 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]); + } + } + + delete model1; + +} + +/// tests that data is properly updated when separator is removed/hidden +/// and data changed signal is emitted +void tst_KDescendantProxyModel::testRemoveSeparator() +{ + auto model1 = createTree("FirstModel"); + KDescendantsProxyModel proxy; + proxy.setSourceModel(model1); + QSignalSpy dataChangedSpy(&proxy, &QAbstractItemModel::dataChanged); + proxy.setDisplayAncestorData(true); + QCOMPARE(dataChangedSpy.count(),1); + dataChangedSpy.clear(); + QCOMPARE(proxy.rowCount(), 6); + { + QStringList results = QStringList() + << "FirstModel0" + << "FirstModel0 / FirstModel0-0" + << "FirstModel0 / FirstModel0-1" + << "FirstModel1" + << "FirstModel1 / FirstModel1-0" + << "FirstModel1 / 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]); + } + } + proxy.setDisplayAncestorData(false); + QCOMPARE(dataChangedSpy.count(),1); + { + 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]); + } + } + +} + QTEST_MAIN(tst_KDescendantProxyModel) #include "kdescendantsproxymodeltest.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.25.0/src/kbreadcrumbselectionmodel.h new/kitemmodels-5.26.0/src/kbreadcrumbselectionmodel.h --- old/kitemmodels-5.25.0/src/kbreadcrumbselectionmodel.h 2016-08-07 13:02:02.000000000 +0200 +++ new/kitemmodels-5.26.0/src/kbreadcrumbselectionmodel.h 2016-09-06 00:36:46.000000000 +0200 @@ -76,7 +76,7 @@ - E @endverbatim - A KBreadcrumbsProxyModel with a breadcrumbLength of 0 and including the actual selection is + A KBreadcrumbsSelectionModel with a breadcrumbLength of 0 and including the actual selection is the same as a KSelectionProxyModel in the KSelectionProxyModel::ExactSelection configuration. @code diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.25.0/src/kdescendantsproxymodel.cpp new/kitemmodels-5.26.0/src/kdescendantsproxymodel.cpp --- old/kitemmodels-5.25.0/src/kdescendantsproxymodel.cpp 2016-08-07 13:02:02.000000000 +0200 +++ new/kitemmodels-5.26.0/src/kdescendantsproxymodel.cpp 2016-09-06 00:36:46.000000000 +0200 @@ -220,10 +220,20 @@ return QAbstractProxyModel::match(start, role, value, hits, flags); } +namespace { + // we only work on DisplayRole for now + static const QVector<int> changedRoles = {Qt::DisplayRole}; +} + void KDescendantsProxyModel::setDisplayAncestorData(bool display) { Q_D(KDescendantsProxyModel); + bool displayChanged = (display != d->m_displayAncestorData); d->m_displayAncestorData = display; + if (displayChanged) { + // send out big hammer. Everything needs to be updated. + emit dataChanged(index(0,0),index(rowCount()-1,columnCount()-1), changedRoles); + } } bool KDescendantsProxyModel::displayAncestorData() const @@ -235,7 +245,12 @@ void KDescendantsProxyModel::setAncestorSeparator(const QString &separator) { Q_D(KDescendantsProxyModel); + bool separatorChanged = (separator != d->m_ancestorSeparator); d->m_ancestorSeparator = separator; + if (separatorChanged && d->m_displayAncestorData) { + // send out big hammer. Everything needs to be updated. + emit dataChanged(index(0,0),index(rowCount()-1,columnCount()-1), changedRoles); + } } QString KDescendantsProxyModel::ancestorSeparator() const
