diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-02-02 14:36:40 +0100 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-02-09 08:46:15 +0000 |
commit | 2f9afadd5d9b4899397dca02588a719123ebc518 (patch) | |
tree | 36e670c45d452ee5d7891259a48ed2c1cd0f09fb /src/qml/util/qqmladaptormodel_p.h | |
parent | 508dcab350521a7dd7a84bbcb7fea973f9483611 (diff) |
QQmlAdaptorModel: add support for row and column
QQmlAdaptorModel is a helper class used by QQmlDelegateModel for
proxying many different models, including QAbstractItemModel,
QQuickListModel etc. This patch will add support for using both
row and column, and not just an index.
Change-Id: I403f4dfc2797ea6af4248485e83a1f0fdf8a90f9
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'src/qml/util/qqmladaptormodel_p.h')
-rw-r--r-- | src/qml/util/qqmladaptormodel_p.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/qml/util/qqmladaptormodel_p.h b/src/qml/util/qqmladaptormodel_p.h index 4d922c68f3..480aa50459 100644 --- a/src/qml/util/qqmladaptormodel_p.h +++ b/src/qml/util/qqmladaptormodel_p.h @@ -56,6 +56,7 @@ #include "private/qqmllistaccessor_p.h" #include <private/qqmlguard_p.h> +#include <private/qqmlnullablevalue_p.h> QT_BEGIN_NAMESPACE @@ -104,6 +105,8 @@ public: virtual void fetchMore(QQmlAdaptorModel &) const {} }; + QQmlNullableValue<int> rows; + QQmlNullableValue<int> columns; const Accessors *accessors; QPersistentModelIndex rootIndex; QQmlListAccessor list; @@ -116,11 +119,15 @@ public: void invalidateModel(QQmlDelegateModel *vdm); bool isValid() const; + int count() const; + int rowCount() const; + int columnCount() const; + int rowAt(int index) const; + int columnAt(int index) const; inline QAbstractItemModel *aim() { return static_cast<QAbstractItemModel *>(object()); } inline const QAbstractItemModel *aim() const { return static_cast<const QAbstractItemModel *>(object()); } - inline int count() const { return qMax(0, accessors->count(*this)); } inline QVariant value(int index, const QString &role) const { return accessors->value(*this, index, role); } inline QQmlDelegateModelItem *createItem(QQmlDelegateModelItemMetaType *metaType, int index) { |