From 340819e81cf36c01bd21a170fd1a932202257899 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 5 Mar 2018 10:42:55 +0100 Subject: 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 --- src/qml/util/qqmladaptormodel.cpp | 6 +----- src/qml/util/qqmladaptormodel_p.h | 2 -- 2 files changed, 1 insertion(+), 7 deletions(-) (limited to 'src/qml/util') 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 rows; - QQmlNullableValue columns; const Accessors *accessors; QPersistentModelIndex rootIndex; QQmlListAccessor list; -- cgit v1.2.3