aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview2/typerolemodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquicklistview2/typerolemodel.h')
-rw-r--r--tests/auto/quick/qquicklistview2/typerolemodel.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview2/typerolemodel.h b/tests/auto/quick/qquicklistview2/typerolemodel.h
new file mode 100644
index 0000000000..f47400a88c
--- /dev/null
+++ b/tests/auto/quick/qquicklistview2/typerolemodel.h
@@ -0,0 +1,30 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QAbstractListModel>
+#include <qqml.h>
+
+class TypeRoleModel : public QAbstractListModel
+{
+ Q_OBJECT
+ QML_ELEMENT
+
+public:
+ enum Role {
+ TypeRole = Qt::UserRole + 1,
+ TextRole,
+ };
+ Q_ENUM(Role)
+
+ enum class Type { PlainText, Markdown, Rect };
+ Q_ENUM(Type)
+
+ explicit TypeRoleModel(QObject *parent = nullptr);
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ QHash<int, QByteArray> roleNames() const override { return _mapRoleNames; }
+
+private:
+ QHash<int, QByteArray> _mapRoleNames;
+};