Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qqmlmodelindexvaluetype_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQMLMODELINDEXVALUETYPE_P_H
5#define QQMLMODELINDEXVALUETYPE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/qabstractitemmodel.h>
19#include <QtCore/qitemselectionmodel.h>
20#include <QtQml/qqml.h>
21#include <QtCore/private/qglobal_p.h>
22
24
26{
28
29 Q_PROPERTY(int row READ row CONSTANT FINAL)
30 Q_PROPERTY(int column READ column CONSTANT FINAL)
32 Q_PROPERTY(bool valid READ isValid CONSTANT FINAL)
33 Q_PROPERTY(QAbstractItemModel *model READ model CONSTANT FINAL)
34 Q_PROPERTY(quint64 internalId READ internalId CONSTANT FINAL)
40
41public:
43 { return QLatin1String("QModelIndex") + propertiesString(v); }
44
45 inline int row() const noexcept { return v.row(); }
46 inline int column() const noexcept { return v.column(); }
47 inline QModelIndex parent() const { return v.parent(); }
48 inline bool isValid() const noexcept { return v.isValid(); }
49 inline QAbstractItemModel *model() const noexcept
50 { return const_cast<QAbstractItemModel *>(v.model()); }
51 quint64 internalId() const { return v.internalId(); }
52
53 static QString propertiesString(const QModelIndex &idx);
54
56 { return QPersistentModelIndex(index); }
57
58 operator QModelIndex() const { return v; }
59};
60
62{
64
65 Q_PROPERTY(int row READ row FINAL)
66 Q_PROPERTY(int column READ column FINAL)
68 Q_PROPERTY(bool valid READ isValid FINAL)
76
77public:
79 { return QLatin1String("QPersistentModelIndex") + QQmlModelIndexValueType::propertiesString(v); }
80
81 inline int row() const { return v.row(); }
82 inline int column() const { return v.column(); }
83 inline QModelIndex parent() const { return v.parent(); }
84 inline bool isValid() const { return v.isValid(); }
85 inline QAbstractItemModel *model() const { return const_cast<QAbstractItemModel *>(v.model()); }
86 inline quint64 internalId() const { return v.internalId(); }
87
88 operator QPersistentModelIndex() const { return v; }
89};
90
92{
94
95 Q_PROPERTY(int top READ top FINAL)
96 Q_PROPERTY(int left READ left FINAL)
97 Q_PROPERTY(int bottom READ bottom FINAL)
98 Q_PROPERTY(int right READ right FINAL)
99 Q_PROPERTY(int width READ width FINAL)
100 Q_PROPERTY(int height READ height FINAL)
104 Q_PROPERTY(bool valid READ isValid FINAL)
105 Q_PROPERTY(bool empty READ isEmpty FINAL)
112
113public:
115 Q_INVOKABLE inline bool contains(const QModelIndex &index) const
116 { return v.contains(index); }
117 Q_INVOKABLE inline bool contains(int row, int column, const QModelIndex &parentIndex) const
118 { return v.contains(row, column, parentIndex); }
120 { return v.intersects(other); }
122 { return v.intersected(other); }
123
124 inline int top() const { return v.top(); }
125 inline int left() const { return v.left(); }
126 inline int bottom() const { return v.bottom(); }
127 inline int right() const { return v.right(); }
128 inline int width() const { return v.width(); }
129 inline int height() const { return v.height(); }
130 inline QPersistentModelIndex &topLeft() const { return const_cast<QPersistentModelIndex &>(v.topLeft()); }
131 inline QPersistentModelIndex &bottomRight() const { return const_cast<QPersistentModelIndex &>(v.bottomRight()); }
132 inline QModelIndex parent() const { return v.parent(); }
133 inline QAbstractItemModel *model() const { return const_cast<QAbstractItemModel *>(v.model()); }
134 inline bool isValid() const { return v.isValid(); }
135 inline bool isEmpty() const { return v.isEmpty(); }
136
137 operator QItemSelectionRange() const { return v; }
138};
139
141{
147};
148
150{
154 QML_FOREIGN(std::vector<QModelIndex>)
156};
157
159{
165};
166
167#undef QLISTVALUETYPE_INVOKABLE_API
168
170
171#endif // QQMLMODELINDEXVALUETYPE_P_H
172
QItemSelectionRange intersected(const QItemSelectionRange &other) const
\inmodule QtCore
\inmodule QtCore
QModelIndex parent() const
Returns the parent of the model index, or QModelIndex() if it has no parent.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
Combined button and popup list for selecting options.
GLsizei const GLfloat * v
[13]
GLint GLsizei GLsizei height
GLuint index
[2]
GLdouble GLdouble GLdouble GLdouble top
GLdouble GLdouble right
GLint GLsizei width
GLint left
GLint GLint bottom
GLenum GLenum GLsizei void GLsizei void * column
GLenum GLenum GLsizei void * row
#define QML_ANONYMOUS
#define QML_SEQUENTIAL_CONTAINER(VALUE_TYPE)
#define QML_EXTENDED(EXTENDED_TYPE)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define QML_FOREIGN(FOREIGN_TYPE)
QLatin1StringView QLatin1String
Definition qstringfwd.h:31
#define Q_PROPERTY(...)
#define Q_INVOKABLE
#define Q_GADGET
unsigned long long quint64
Definition qtypes.h:56
QSharedPointer< T > other(t)
[5]
QPersistentModelIndex & topLeft() const
QPersistentModelIndex & bottomRight() const
Q_INVOKABLE bool contains(int row, int column, const QModelIndex &parentIndex) const
Q_INVOKABLE bool contains(const QModelIndex &index) const
Q_INVOKABLE bool intersects(const QItemSelectionRange &other) const
Q_INVOKABLE QItemSelectionRange intersected(const QItemSelectionRange &other) const
QAbstractItemModel * model() const noexcept
static QString propertiesString(const QModelIndex &idx)
Q_INVOKABLE QString toString() const
static QPersistentModelIndex toPersistentModelIndex(const QModelIndex &index)