diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-03-05 10:42:55 +0100 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-04-12 13:42:10 +0000 |
commit | 340819e81cf36c01bd21a170fd1a932202257899 (patch) | |
tree | 26c5dda27fc30062fd778e21ca1594f7b5d9adf9 /src/qml/util | |
parent | a5d2fb468cabff8dc0702c7ddcd9f5b08993b827 (diff) |
QQmlAdaptorModel: make a models row/column count read-only
This change partly revert 59a9c7c3d9edeb9, since we no
longer make use of the introduced API.
Being able to override the row/column count for a delegate model
was a wrong step. If a view needs to operate on a row/column count
that is different from what the model offers, then the mapping
should be done in the view (or in a proxy model), and not in the
delegate model.
Change-Id: I32b0dfa977dd7cae33c399e138aac847e49aa94a
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/qml/util')
-rw-r--r-- | src/qml/util/qqmladaptormodel.cpp | 6 | ||||
-rw-r--r-- | src/qml/util/qqmladaptormodel_p.h | 2 |
2 files changed, 1 insertions, 7 deletions
diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp index f754e0e1a5..312466e46a 100644 --- a/src/qml/util/qqmladaptormodel.cpp +++ b/src/qml/util/qqmladaptormodel.cpp @@ -1000,7 +1000,7 @@ void QQmlAdaptorModel::invalidateModel(QQmlDelegateModel *vdm) bool QQmlAdaptorModel::isValid() const { - return accessors != &qt_vdm_null_accessors || rows.isValid(); + return accessors != &qt_vdm_null_accessors; } int QQmlAdaptorModel::count() const @@ -1010,15 +1010,11 @@ int QQmlAdaptorModel::count() const int QQmlAdaptorModel::rowCount() const { - if (rows.isValid()) - return rows.value; return qMax(0, accessors->rowCount(*this)); } int QQmlAdaptorModel::columnCount() const { - if (columns.isValid()) - return columns.value; return qMax(isValid() ? 1 : 0, accessors->columnCount(*this)); } diff --git a/src/qml/util/qqmladaptormodel_p.h b/src/qml/util/qqmladaptormodel_p.h index 82a4ebfcf6..b706fcb5f2 100644 --- a/src/qml/util/qqmladaptormodel_p.h +++ b/src/qml/util/qqmladaptormodel_p.h @@ -106,8 +106,6 @@ public: virtual void fetchMore(QQmlAdaptorModel &) const {} }; - QQmlNullableValue<int> rows; - QQmlNullableValue<int> columns; const Accessors *accessors; QPersistentModelIndex rootIndex; QQmlListAccessor list; |