diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-04-12 13:02:30 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-04-12 13:23:43 +0000 |
commit | a5d2fb468cabff8dc0702c7ddcd9f5b08993b827 (patch) | |
tree | 6431dc92b0be786dabfc420f9cbbadeb746dfcc9 /src/qml/util | |
parent | b17576fe8f805d674e8ce66b22f19fe0cda1a182 (diff) |
QQmlAdaptorModel: support dataChanged signals from multi-column models
When receiving a signal that model items have changed, the current
implementation assumed that the underlying QAIM only had one column.
This patch will check how many columns actually changed, and
make sure we call itemsChanged for them all.
Change-Id: I05f301dee604f2675ec7e89dfbca28b6f956d483
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/qml/util')
-rw-r--r-- | src/qml/util/qqmladaptormodel.cpp | 5 | ||||
-rw-r--r-- | src/qml/util/qqmladaptormodel_p.h | 1 |
2 files changed, 6 insertions, 0 deletions
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()); } |