aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp11
-rw-r--r--src/qml/util/qqmladaptormodel.cpp5
-rw-r--r--src/qml/util/qqmladaptormodel_p.h1
3 files changed, 15 insertions, 2 deletions
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index 29e0baa3ac..27a84bc2f1 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -1709,8 +1709,15 @@ void QQmlDelegateModel::_q_rowsMoved(
void QQmlDelegateModel::_q_dataChanged(const QModelIndex &begin, const QModelIndex &end, const QVector<int> &roles)
{
Q_D(QQmlDelegateModel);
- if (begin.parent() == d->m_adaptorModel.rootIndex)
- _q_itemsChanged(begin.row(), end.row() - begin.row() + 1, roles);
+ if (begin.parent() != d->m_adaptorModel.rootIndex)
+ return;
+
+ int rowCount = end.row() - begin.row() + 1;
+
+ for (int col = begin.column(); col <= end.column(); ++col) {
+ int startIndex = d->m_adaptorModel.indexAt(begin.row(), col);
+ _q_itemsChanged(startIndex, rowCount, roles);
+ }
}
bool QQmlDelegateModel::isDescendantOf(const QPersistentModelIndex& desc, const QList< QPersistentModelIndex >& parents) const
diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp
index 1cc347d6bc..f754e0e1a5 100644
--- a/src/qml/util/qqmladaptormodel.cpp
+++ b/src/qml/util/qqmladaptormodel.cpp
@@ -1034,6 +1034,11 @@ int QQmlAdaptorModel::columnAt(int index) const
return count <= 0 ? -1 : index / count;
}
+int QQmlAdaptorModel::indexAt(int row, int column) const
+{
+ return row + (column * rowCount());
+}
+
void QQmlAdaptorModel::objectDestroyed(QObject *)
{
setModel(QVariant(), nullptr, nullptr);
diff --git a/src/qml/util/qqmladaptormodel_p.h b/src/qml/util/qqmladaptormodel_p.h
index d3b26a1ad5..82a4ebfcf6 100644
--- a/src/qml/util/qqmladaptormodel_p.h
+++ b/src/qml/util/qqmladaptormodel_p.h
@@ -125,6 +125,7 @@ public:
int columnCount() const;
int rowAt(int index) const;
int columnAt(int index) const;
+ int indexAt(int row, int column) const;
inline QAbstractItemModel *aim() { return static_cast<QAbstractItemModel *>(object()); }
inline const QAbstractItemModel *aim() const { return static_cast<const QAbstractItemModel *>(object()); }