aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsample/modelindex.h
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/tests/libsample/modelindex.h')
-rw-r--r--sources/shiboken6/tests/libsample/modelindex.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/libsample/modelindex.h b/sources/shiboken6/tests/libsample/modelindex.h
new file mode 100644
index 000000000..48e1b7de3
--- /dev/null
+++ b/sources/shiboken6/tests/libsample/modelindex.h
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+#ifndef MODELINDEX_H
+#define MODELINDEX_H
+
+class ModelIndex
+{
+public:
+ ModelIndex() = default;
+
+ inline void setValue(int value) { m_value = value; }
+ inline int value() const { return m_value; }
+ static int getValue(const ModelIndex &index) { return index.value(); }
+
+private:
+ int m_value = 0;
+};
+
+class ReferentModelIndex
+{
+public:
+ ReferentModelIndex() = default;
+
+ explicit ReferentModelIndex(const ModelIndex &index) : m_index(index) {}
+
+ inline void setValue(int value) { m_index.setValue(value); }
+ inline int value() const { return m_index.value(); }
+ operator const ModelIndex&() const { return m_index; }
+
+private:
+ ModelIndex m_index;
+};
+
+class PersistentModelIndex
+{
+public:
+ PersistentModelIndex() = default;
+
+ explicit PersistentModelIndex(const ModelIndex &index) : m_index(index) {}
+
+ inline void setValue(int value) { m_index.setValue(value); }
+ inline int value() const { return m_index.value(); }
+ operator ModelIndex() const { return m_index; }
+
+private:
+ ModelIndex m_index;
+};
+
+#endif // MODELINDEX_H