Hello community, here is the log from the commit of package kitemmodels for openSUSE:Factory checked in at 2020-11-19 11:51:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kitemmodels (Old) and /work/SRC/openSUSE:Factory/.kitemmodels.new.5913 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kitemmodels" Thu Nov 19 11:51:11 2020 rev:85 rq:848562 version:5.76.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kitemmodels/kitemmodels.changes 2020-10-12 13:57:05.362160427 +0200 +++ /work/SRC/openSUSE:Factory/.kitemmodels.new.5913/kitemmodels.changes 2020-11-23 10:32:35.245499202 +0100 @@ -1,0 +2,15 @@ +Sat Nov 7 21:34:56 UTC 2020 - Christophe Giboudeaux <christo...@krop.fr> + +- Update to 5.76.0 + * New feature release + * For more details please see: + * https://kde.org/announcements/kde-frameworks-5.76.0 +- Changes since 5.75.0: + * fix KDescendantProxyModel smoketest + * KRearrangeColumnsProxyModel: fix crash with no source model + * KRearrangeColumnsProxyModel: only column 0 has children + * If include is define in .h remove it if it's defined in .cpp too (scripted) + * Fix autotest + * just proxy sourceModel's headerData + +------------------------------------------------------------------- Old: ---- kitemmodels-5.75.0.tar.xz kitemmodels-5.75.0.tar.xz.sig New: ---- kitemmodels-5.76.0.tar.xz kitemmodels-5.76.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kitemmodels.spec ++++++ --- /var/tmp/diff_new_pack.IeAPc6/_old 2020-11-23 10:32:35.853499868 +0100 +++ /var/tmp/diff_new_pack.IeAPc6/_new 2020-11-23 10:32:35.857499873 +0100 @@ -17,7 +17,7 @@ %define lname libKF5ItemModels5 -%define _tar_path 5.75 +%define _tar_path 5.76 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) @@ -26,7 +26,7 @@ # Only needed for the package signature condition %bcond_without lang Name: kitemmodels -Version: 5.75.0 +Version: 5.76.0 Release: 0 Summary: Set of item models extending the Qt model-view framework License: LGPL-2.1-or-later ++++++ kitemmodels-5.75.0.tar.xz -> kitemmodels-5.76.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.75.0/CMakeLists.txt new/kitemmodels-5.76.0/CMakeLists.txt --- old/kitemmodels-5.75.0/CMakeLists.txt 2020-10-04 11:53:39.000000000 +0200 +++ new/kitemmodels-5.76.0/CMakeLists.txt 2020-11-07 12:40:03.000000000 +0100 @@ -1,10 +1,10 @@ cmake_minimum_required(VERSION 3.5) -set(KF5_VERSION "5.75.0") # handled by release scripts +set(KF5_VERSION "5.76.0") # handled by release scripts project(KItemModels VERSION ${KF5_VERSION}) include(FeatureSummary) -find_package(ECM 5.75.0 NO_MODULE) +find_package(ECM 5.76.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.75.0/autotests/kcolumnheadersmodeltest.cpp new/kitemmodels-5.76.0/autotests/kcolumnheadersmodeltest.cpp --- old/kitemmodels-5.75.0/autotests/kcolumnheadersmodeltest.cpp 2020-10-04 11:53:39.000000000 +0200 +++ new/kitemmodels-5.76.0/autotests/kcolumnheadersmodeltest.cpp 2020-11-07 12:40:03.000000000 +0100 @@ -31,8 +31,7 @@ model->setSourceModel(sourceModel); - auto tester = new QAbstractItemModelTester(model); - Q_UNUSED(tester); + new QAbstractItemModelTester(model); QCOMPARE(model->rowCount(), 5); QCOMPARE(model->data(model->index(0, 0), Qt::DisplayRole).toString(), QStringLiteral("Test 1")); @@ -65,8 +64,7 @@ }); model->setSourceModel(sourceModel); - auto tester = new QAbstractItemModelTester(model); - Q_UNUSED(tester); + new QAbstractItemModelTester(model); QSignalSpy spy{model, &QAbstractItemModel::rowsInserted}; QVERIFY(spy.isValid()); @@ -137,8 +135,7 @@ model->setSourceModel(sourceModel); - auto tester = new QAbstractItemModelTester(model); - Q_UNUSED(tester); + new QAbstractItemModelTester(model); QSignalSpy spy{model, &QAbstractItemModel::rowsRemoved}; QVERIFY(spy.isValid()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.75.0/autotests/kdescendantsproxymodel_smoketest.cpp new/kitemmodels-5.76.0/autotests/kdescendantsproxymodel_smoketest.cpp --- old/kitemmodels-5.75.0/autotests/kdescendantsproxymodel_smoketest.cpp 2020-10-04 11:53:39.000000000 +0200 +++ new/kitemmodels-5.76.0/autotests/kdescendantsproxymodel_smoketest.cpp 2020-11-07 12:40:03.000000000 +0100 @@ -21,6 +21,51 @@ } + void newInsertWithDataChangedTest(const QString &name, const IndexFinder &indexFinder, int start, int end, int rowCount, const QList<int> &indexWithDataChanged) + { + processTestName(name); + + SignalList signalList; + PersistentChangeList persistentList; + + signalList << m_proxyModelTest->getSignal(RowsAboutToBeInserted, indexFinder, start, end); + signalList << m_proxyModelTest->getSignal(RowsInserted, indexFinder, start, end); + + for (int index : indexWithDataChanged) { + const IndexFinder changedFinder({index}); + signalList << m_proxyModelTest->getSignal(DataChanged, changedFinder, changedFinder); + } + + if (rowCount - 1 + (end - start + 1) > end) { + persistentList << m_proxyModelTest->getChange(indexFinder, start, rowCount - 1, end - start + 1); + } + + QTest::newRow(name.toLatin1()) << signalList << persistentList; + } + + void newRemoveWithDataChangedTest(const QString &name, const IndexFinder &indexFinder, int start, int end, int rowCount, const QList<int> &indexWithDataChanged) + { + processTestName(name); + + SignalList signalList; + PersistentChangeList persistentList; + + signalList << m_proxyModelTest->getSignal(RowsAboutToBeRemoved, indexFinder, start, end); + signalList << m_proxyModelTest->getSignal(RowsRemoved, indexFinder, start, end); + + for (int index : indexWithDataChanged) { + const IndexFinder changedFinder({index}); + signalList << m_proxyModelTest->getSignal(DataChanged, changedFinder, changedFinder); + } + + persistentList << m_proxyModelTest->getChange(indexFinder, start, end, -1, true); + if (rowCount - 1 != end) { + persistentList << m_proxyModelTest->getChange(indexFinder, end + 1, rowCount - 1, -1 * (end - start + 1)); + } + + QTest::newRow(name.toLatin1()) << signalList << persistentList; + } + public Q_SLOTS: void testInsertWhenEmptyData() override { @@ -58,10 +103,10 @@ newInsertTest(QStringLiteral("insert01"), indexFinder, 0, 0, 43); newInsertTest(QStringLiteral("insert02"), indexFinder, 0, 9, 43); - newInsertTest(QStringLiteral("insert03"), indexFinder, 43, 43, 43); - newInsertTest(QStringLiteral("insert04"), indexFinder, 43, 52, 43); - newInsertTest(QStringLiteral("insert05"), indexFinder, 7, 7, 43); - newInsertTest(QStringLiteral("insert06"), indexFinder, 7, 16, 43); + newInsertWithDataChangedTest(QStringLiteral("insert03"), indexFinder, 43, 43, 43, QList<int>({42})); + newInsertWithDataChangedTest(QStringLiteral("insert04"), indexFinder, 43, 52, 43, QList<int>({42})); + newInsertWithDataChangedTest(QStringLiteral("insert05"), indexFinder, 7, 7, 43, QList<int>({6})); + newInsertWithDataChangedTest(QStringLiteral("insert06"), indexFinder, 7, 16, 43, QList<int>({6})); skipTestData(QStringLiteral("insert07")); skipTestData(QStringLiteral("insert08")); skipTestData(QStringLiteral("insert09")); @@ -83,12 +128,13 @@ static const IndexFinder indexFinder; - newInsertTest(QStringLiteral("insert01"), indexFinder, 9, 9, 43); - newInsertTest(QStringLiteral("insert02"), indexFinder, 9, 18, 43); - newInsertTest(QStringLiteral("insert03"), indexFinder, 37, 37, 43); - newInsertTest(QStringLiteral("insert04"), indexFinder, 37, 46, 43); - newInsertTest(QStringLiteral("insert05"), indexFinder, 15, 15, 43); - newInsertTest(QStringLiteral("insert06"), indexFinder, 15, 24, 43); + newInsertWithDataChangedTest(QStringLiteral("insert01"), indexFinder, 9, 9, 43, QList<int>({8})); + newInsertWithDataChangedTest(QStringLiteral("insert02"), indexFinder, 9, 18, 43, QList<int>({8})); + newInsertWithDataChangedTest(QStringLiteral("insert03"), indexFinder, 37, 37, 43, QList<int>({8, 36})); + + newInsertWithDataChangedTest(QStringLiteral("insert04"), indexFinder, 37, 46, 43, QList<int>({8, 36})); + newInsertWithDataChangedTest(QStringLiteral("insert05"), indexFinder, 15, 15, 43, QList<int>({8, 14})); + newInsertWithDataChangedTest(QStringLiteral("insert06"), indexFinder, 15, 24, 43, QList<int>({8, 14})); skipTestData(QStringLiteral("insert07")); skipTestData(QStringLiteral("insert08")); skipTestData(QStringLiteral("insert09")); @@ -110,12 +156,12 @@ static const IndexFinder indexFinder; - newInsertTest(QStringLiteral("insert01"), indexFinder, 17, 17, 43); - newInsertTest(QStringLiteral("insert02"), indexFinder, 17, 26, 43); - newInsertTest(QStringLiteral("insert03"), indexFinder, 32, 32, 43); - newInsertTest(QStringLiteral("insert04"), indexFinder, 32, 41, 43); - newInsertTest(QStringLiteral("insert05"), indexFinder, 23, 23, 43); - newInsertTest(QStringLiteral("insert06"), indexFinder, 23, 32, 43); + newInsertWithDataChangedTest(QStringLiteral("insert01"), indexFinder, 17, 17, 43, QList<int>({16})); + newInsertWithDataChangedTest(QStringLiteral("insert02"), indexFinder, 17, 26, 43, QList<int>({16})); + newInsertWithDataChangedTest(QStringLiteral("insert03"), indexFinder, 32, 32, 43, QList<int>({16, 31})); + newInsertWithDataChangedTest(QStringLiteral("insert04"), indexFinder, 32, 41, 43, QList<int>({16, 31})); + newInsertWithDataChangedTest(QStringLiteral("insert05"), indexFinder, 23, 23, 43, QList<int>({16, 22})); + newInsertWithDataChangedTest(QStringLiteral("insert06"), indexFinder, 23, 32, 43, QList<int>({16, 22})); skipTestData(QStringLiteral("insert07")); skipTestData(QStringLiteral("insert08")); skipTestData(QStringLiteral("insert09")); @@ -139,7 +185,7 @@ newRemoveTest(QStringLiteral("remove01"), indexFinder, 0, 0, 43); newRemoveTest(QStringLiteral("remove02"), indexFinder, 0, 7, 43); - newRemoveTest(QStringLiteral("remove03"), indexFinder, 42, 42, 43); + newRemoveWithDataChangedTest(QStringLiteral("remove03"), indexFinder, 42, 42, 43, QList<int>({41})); } void testRemoveFromTopLevelData() override @@ -149,9 +195,9 @@ static const IndexFinder indexFinder; - newRemoveTest(QStringLiteral("remove01"), indexFinder, 9, 9, 43); - newRemoveTest(QStringLiteral("remove02"), indexFinder, 9, 15, 43); - newRemoveTest(QStringLiteral("remove03"), indexFinder, 36, 36, 43); + newRemoveWithDataChangedTest(QStringLiteral("remove01"), indexFinder, 9, 9, 43, QList<int>({8})); + newRemoveWithDataChangedTest(QStringLiteral("remove02"), indexFinder, 9, 15, 43, QList<int>({8})); + newRemoveWithDataChangedTest(QStringLiteral("remove03"), indexFinder, 36, 36, 43, QList<int>({35, 8, 35})); } void testRemoveFromSecondLevelData() override @@ -160,10 +206,9 @@ QTest::addColumn<PersistentChangeList>("changeList"); static const IndexFinder indexFinder; - - newRemoveTest(QStringLiteral("remove01"), indexFinder, 17, 17, 43); - newRemoveTest(QStringLiteral("remove02"), indexFinder, 17, 23, 43); - newRemoveTest(QStringLiteral("remove03"), indexFinder, 31, 31, 43); + newRemoveWithDataChangedTest(QStringLiteral("remove01"), indexFinder, 17, 17, 43,QList<int>({ 16})); + newRemoveWithDataChangedTest(QStringLiteral("remove02"), indexFinder, 17, 23, 43, QList<int>({16})); + newRemoveWithDataChangedTest(QStringLiteral("remove03"), indexFinder, 31, 31, 43, QList<int>({30, 16, 30})); } void testMoveFromRootData() override diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.75.0/autotests/krearrangecolumnsproxymodeltest.cpp new/kitemmodels-5.76.0/autotests/krearrangecolumnsproxymodeltest.cpp --- old/kitemmodels-5.75.0/autotests/krearrangecolumnsproxymodeltest.cpp 2020-10-04 11:53:39.000000000 +0200 +++ new/kitemmodels-5.76.0/autotests/krearrangecolumnsproxymodeltest.cpp 2020-11-07 12:40:03.000000000 +0100 @@ -9,8 +9,7 @@ #include <QTest> #include <QDebug> #include <QStandardItemModel> - -#include <QTreeView> +#include <QAbstractItemModelTester> #include <krearrangecolumnsproxymodel.h> #include "test_model_helpers.h" @@ -59,6 +58,7 @@ // Then the proxy should show nothing (no columns selected) QCOMPARE(pm.rowCount(), 0); QCOMPARE(pm.columnCount(), 0); + QVERIFY(!pm.index(0, 0).isValid()); } void shouldShowNothingIfNoColumnSelection() @@ -120,6 +120,7 @@ { // Given a rearrange-columns proxy KRearrangeColumnsProxyModel pm; + new QAbstractItemModelTester(&pm); // When setting it to a source model, with columns rearranged setup(pm); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.75.0/autotests/proxymodeltestsuite/dynamictreemodel.cpp new/kitemmodels-5.76.0/autotests/proxymodeltestsuite/dynamictreemodel.cpp --- old/kitemmodels-5.75.0/autotests/proxymodeltestsuite/dynamictreemodel.cpp 2020-10-04 11:53:39.000000000 +0200 +++ new/kitemmodels-5.76.0/autotests/proxymodeltestsuite/dynamictreemodel.cpp 2020-11-07 12:40:03.000000000 +0100 @@ -6,8 +6,6 @@ #include "dynamictreemodel.h" -#include <QHash> -#include <QList> #include <QMimeData> #include <QDebug> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.75.0/autotests/proxymodeltestsuite/modelcommander.cpp new/kitemmodels-5.76.0/autotests/proxymodeltestsuite/modelcommander.cpp --- old/kitemmodels-5.75.0/autotests/proxymodeltestsuite/modelcommander.cpp 2020-10-04 11:53:39.000000000 +0200 +++ new/kitemmodels-5.76.0/autotests/proxymodeltestsuite/modelcommander.cpp 2020-11-07 12:40:03.000000000 +0100 @@ -5,7 +5,6 @@ */ #include "modelcommander.h" -#include "dynamictreemodel.h" #include <QDebug> ModelCommander::ModelCommander(DynamicTreeModel *model, QObject *parent) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.75.0/autotests/proxymodeltestsuite/proxymodeltest.cpp new/kitemmodels-5.76.0/autotests/proxymodeltestsuite/proxymodeltest.cpp --- old/kitemmodels-5.75.0/autotests/proxymodeltestsuite/proxymodeltest.cpp 2020-10-04 11:53:39.000000000 +0200 +++ new/kitemmodels-5.76.0/autotests/proxymodeltestsuite/proxymodeltest.cpp 2020-11-07 12:40:03.000000000 +0100 @@ -6,11 +6,9 @@ #include "proxymodeltest.h" -#include "dynamictreemodel.h" #include <QSortFilterProxyModel> -#include "modelspy.h" ProxyModelTest::ProxyModelTest(QObject *parent) : QObject(parent), @@ -234,7 +232,7 @@ break; } case DataChanged: { - QVERIFY(expected.size() == 2); + QCOMPARE(expected.size(), 2); IndexFinder topLeftFinder = qvariant_cast<IndexFinder>(expected.at(0)); topLeftFinder.setModel(m_proxyModel); QModelIndex topLeft = topLeftFinder.getIndex(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.75.0/src/core/kdescendantsproxymodel.cpp new/kitemmodels-5.76.0/src/core/kdescendantsproxymodel.cpp --- old/kitemmodels-5.75.0/src/core/kdescendantsproxymodel.cpp 2020-10-04 11:53:39.000000000 +0200 +++ new/kitemmodels-5.76.0/src/core/kdescendantsproxymodel.cpp 2020-11-07 12:40:03.000000000 +0100 @@ -691,7 +691,8 @@ return QVariant(); } - return QAbstractProxyModel::headerData(section, orientation, role); + // Here is safe to do sourceModel()->headerData, as in this proxy we neither filter out nor reorder columns + return sourceModel()->headerData(section, orientation, role); } Qt::ItemFlags KDescendantsProxyModel::flags(const QModelIndex &index) const @@ -780,7 +781,9 @@ if (rowCount == difference) { const QModelIndex index = q->mapFromSource(parent); - Q_EMIT q->dataChanged(index, index, {KDescendantsProxyModel::ExpandableRole, KDescendantsProxyModel::ExpandedRole, KDescendantsProxyModel::HasSiblingsRole}); + if (parent.isValid()) { + Q_EMIT q->dataChanged(index, index, {KDescendantsProxyModel::ExpandableRole, KDescendantsProxyModel::ExpandedRole, KDescendantsProxyModel::HasSiblingsRole}); + } // @p parent was not a parent before. m_pendingParents.append(parent); scheduleProcessPendingParents(); @@ -880,12 +883,15 @@ q->endInsertRows(); scheduleProcessPendingParents(); - const QModelIndex index = q->mapFromSource(parent); - Q_EMIT q->dataChanged(index, index, {KDescendantsProxyModel::ExpandableRole, KDescendantsProxyModel::ExpandedRole, KDescendantsProxyModel::HasSiblingsRole}); + if (parent.isValid()) { + const QModelIndex index = q->mapFromSource(parent); + Q_EMIT q->dataChanged(index, index, {KDescendantsProxyModel::ExpandableRole, KDescendantsProxyModel::ExpandedRole, KDescendantsProxyModel::HasSiblingsRole}); + } if (start > 0) { notifyhasSiblings(q->sourceModel()->index(start - 1, 0, parent)); } + } void KDescendantsProxyModelPrivate::sourceRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) @@ -938,8 +944,10 @@ Q_UNUSED(end) if (!q->isSourceIndexExpanded(parent) || !q->isSourceIndexVisible(parent)) { - const QModelIndex index = q->mapFromSource(parent); - Q_EMIT q->dataChanged(index, index, {KDescendantsProxyModel::ExpandableRole, KDescendantsProxyModel::ExpandedRole}); + if (parent.isValid()) { + const QModelIndex index = q->mapFromSource(parent); + Q_EMIT q->dataChanged(index, index, {KDescendantsProxyModel::ExpandableRole, KDescendantsProxyModel::ExpandedRole}); + } return; } @@ -971,8 +979,10 @@ if (rowCount != start || rowCount == 0) { q->endRemoveRows(); - const QModelIndex index = q->mapFromSource(parent); - Q_EMIT q->dataChanged(index, index, {KDescendantsProxyModel::ExpandableRole, KDescendantsProxyModel::ExpandedRole}); + if (parent.isValid()) { + const QModelIndex index = q->mapFromSource(parent); + Q_EMIT q->dataChanged(index, index, {KDescendantsProxyModel::ExpandableRole, KDescendantsProxyModel::ExpandedRole}); + } if (start > 0) { notifyhasSiblings(q->sourceModel()->index(start - 1, 0, parent)); } @@ -1093,15 +1103,20 @@ m_mapping.insert(newEnd, proxyRow + newEnd.row()); q->endRemoveRows(); - const QModelIndex index = q->mapFromSource(parent); - Q_EMIT q->dataChanged(index, index, {KDescendantsProxyModel::ExpandableRole}); + if (parent.isValid()) { + const QModelIndex oindex = q->mapFromSource(parent); + QVector<int> rolesChanged({KDescendantsProxyModel::ExpandableRole}); + + if (!q->sourceModel()->hasChildren(parent)) { + rolesChanged << KDescendantsProxyModel::ExpandedRole; + } else if (q->sourceModel()->rowCount(parent) <= start) { + const QModelIndex index = q->mapFromSource(q->sourceModel()->index(q->sourceModel()->rowCount(parent) - 1, 0, parent)); + Q_EMIT q->dataChanged(index, index, {KDescendantsProxyModel::ExpandedRole}); + } - if (!q->sourceModel()->hasChildren(parent)) { - Q_EMIT q->dataChanged(index, index, {KDescendantsProxyModel::ExpandedRole}); - } else if (q->sourceModel()->rowCount(parent) <= start) { - const QModelIndex index = q->mapFromSource(q->sourceModel()->index(q->sourceModel()->rowCount(parent) - 1, 0, parent)); - Q_EMIT q->dataChanged(index, index, {KDescendantsProxyModel::ExpandedRole}); + Q_EMIT q->dataChanged(oindex, oindex, rolesChanged); } + if (start > 0) { notifyhasSiblings(q->sourceModel()->index(start - 1, 0, parent)); } @@ -1112,6 +1127,21 @@ Q_Q(KDescendantsProxyModel); Q_UNUSED(destStart) + + if (q->isSourceIndexExpanded(srcParent) && q->isSourceIndexVisible(srcParent) && + (!q->isSourceIndexExpanded(destParent) || !q->isSourceIndexVisible(destParent))) { + const QModelIndex proxySrcParent = q->mapFromSource(srcParent); + const int proxyParentRow = proxySrcParent.isValid() ? proxySrcParent.row() : 0; + q->beginRemoveRows(QModelIndex(), proxyParentRow + srcStart, proxyParentRow + srcEnd); + + } else if ((!q->isSourceIndexExpanded(srcParent) || !q->isSourceIndexVisible(srcParent)) && + q->isSourceIndexExpanded(destParent) && q->isSourceIndexVisible(destParent)) { + const QModelIndex proxyDestParent = q->mapFromSource(srcParent); + const int proxyParentRow = proxyDestParent.isValid() ? proxyDestParent.row() : 0; + + q->beginInsertRows(QModelIndex(), proxyParentRow + destStart, proxyParentRow + destStart + (srcEnd - srcStart)); + } + sourceLayoutAboutToBeChanged(); } @@ -1124,6 +1154,14 @@ Q_UNUSED(srcEnd) Q_UNUSED(destParent) Q_UNUSED(destStart) + + if (q->isSourceIndexExpanded(srcParent) && q->isSourceIndexVisible(srcParent) && + (!q->isSourceIndexExpanded(destParent) || !q->isSourceIndexVisible(destParent))) { + q->endRemoveRows(); + } else if (!q->isSourceIndexExpanded(srcParent) && q->isSourceIndexExpanded(destParent)) { + q->endInsertRows(); + } + sourceLayoutChanged(); const QModelIndex index1 = q->mapFromSource(srcParent); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.75.0/src/core/knumbermodel.cpp new/kitemmodels-5.76.0/src/core/knumbermodel.cpp --- old/kitemmodels-5.75.0/src/core/knumbermodel.cpp 2020-10-04 11:53:39.000000000 +0200 +++ new/kitemmodels-5.76.0/src/core/knumbermodel.cpp 2020-11-07 12:40:03.000000000 +0100 @@ -6,7 +6,6 @@ #include "knumbermodel.h" -#include <QLocale> #include <QtMath> #include <cmath> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kitemmodels-5.75.0/src/core/krearrangecolumnsproxymodel.cpp new/kitemmodels-5.76.0/src/core/krearrangecolumnsproxymodel.cpp --- old/kitemmodels-5.75.0/src/core/krearrangecolumnsproxymodel.cpp 2020-10-04 11:53:39.000000000 +0200 +++ new/kitemmodels-5.76.0/src/core/krearrangecolumnsproxymodel.cpp 2020-11-07 12:40:03.000000000 +0100 @@ -59,6 +59,9 @@ return false; if (d_ptr->m_sourceColumns.isEmpty()) // no columns configured yet return false; + if (parent.column() > 0) { + return false; + } const QModelIndex sourceParent = mapToSource(parent).sibling(parent.row(), 0); return sourceModel()->rowCount(sourceParent) > 0; } @@ -78,6 +81,18 @@ #endif Q_ASSERT(column >= 0); + // Only first column has children + if (parent.column() > 0) { + return {}; + } + + if (!sourceModel()) { + return {}; + } + if (d_ptr->m_sourceColumns.isEmpty()) { + return {}; + } + // The parent in the source model is on column 0, whatever swapping we are doing const QModelIndex sourceParent = mapToSource(parent).sibling(parent.row(), 0); @@ -104,6 +119,9 @@ QVariant KRearrangeColumnsProxyModel::headerData(int section, Qt::Orientation orientation, int role) const { if (orientation == Qt::Horizontal) { + if (!sourceModel() || section >= d_ptr->m_sourceColumns.count()) { + return QVariant(); + } const int sourceCol = sourceColumnForProxyColumn(section); return sourceModel()->headerData(sourceCol, orientation, role); } else { _______________________________________________ openSUSE Commits mailing list -- commit@lists.opensuse.org To unsubscribe, email commit-le...@lists.opensuse.org List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/commit@lists.opensuse.org