Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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)
40
41public:
43 { return QLatin1String("QModelIndex") + propertiesString(v); }
44
45 Q_REVISION(6, 7) Q_INVOKABLE QVariant data(int role = Qt::DisplayRole) const
46 { return v.data(role); }
47
48 inline int row() const noexcept { return v.row(); }
49 inline int column() const noexcept { return v.column(); }
50 inline QModelIndex parent() const { return v.parent(); }
51 inline bool isValid() const noexcept { return v.isValid(); }
52 inline QAbstractItemModel *model() const noexcept
53 { return const_cast<QAbstractItemModel *>(v.model()); }
54 quint64 internalId() const { return v.internalId(); }
55
56 static QString propertiesString(const QModelIndex &idx);
57
60
61 operator QModelIndex() const { return v; }
62};
63
65{
67
68 Q_PROPERTY(int row READ row FINAL)
69 Q_PROPERTY(int column READ column FINAL)
71 Q_PROPERTY(bool valid READ isValid FINAL)
79
80public:
82 { return QLatin1String("QPersistentModelIndex") + QQmlModelIndexValueType::propertiesString(v); }
83
84 Q_REVISION(6, 7) Q_INVOKABLE QVariant data(int role = Qt::DisplayRole) const
85 { return v.data(role); }
86
87 inline int row() const { return v.row(); }
88 inline int column() const { return v.column(); }
89 inline QModelIndex parent() const { return v.parent(); }
90 inline bool isValid() const { return v.isValid(); }
91 inline QAbstractItemModel *model() const { return const_cast<QAbstractItemModel *>(v.model()); }
92 inline quint64 internalId() const { return v.internalId(); }
93
94 operator QPersistentModelIndex() const { return v; }
95};
96
98{
100
101 Q_PROPERTY(int top READ top FINAL)
102 Q_PROPERTY(int left READ left FINAL)
103 Q_PROPERTY(int bottom READ bottom FINAL)
104 Q_PROPERTY(int right READ right FINAL)
105 Q_PROPERTY(int width READ width FINAL)
106 Q_PROPERTY(int height READ height FINAL)
110 Q_PROPERTY(bool valid READ isValid FINAL)
111 Q_PROPERTY(bool empty READ isEmpty FINAL)
118
119public:
121 Q_INVOKABLE inline bool contains(const QModelIndex &index) const
122 { return v.contains(index); }
123 Q_INVOKABLE inline bool contains(int row, int column, const QModelIndex &parentIndex) const
124 { return v.contains(row, column, parentIndex); }
126 { return v.intersects(other); }
129
130 inline int top() const { return v.top(); }
131 inline int left() const { return v.left(); }
132 inline int bottom() const { return v.bottom(); }
133 inline int right() const { return v.right(); }
134 inline int width() const { return v.width(); }
135 inline int height() const { return v.height(); }
136 inline QPersistentModelIndex &topLeft() const { return const_cast<QPersistentModelIndex &>(v.topLeft()); }
137 inline QPersistentModelIndex &bottomRight() const { return const_cast<QPersistentModelIndex &>(v.bottomRight()); }
138 inline QModelIndex parent() const { return v.parent(); }
139 inline QAbstractItemModel *model() const { return const_cast<QAbstractItemModel *>(v.model()); }
140 inline bool isValid() const { return v.isValid(); }
141 inline bool isEmpty() const { return v.isEmpty(); }
142
143 operator QItemSelectionRange() const { return v; }
144};
145
154
163
172
173#undef QLISTVALUETYPE_INVOKABLE_API
174
176
177#endif // QQMLMODELINDEXVALUETYPE_P_H
178
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.
constexpr bool isValid() const noexcept
Returns {true} if this model index is valid; otherwise returns {false}.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
void * data()
Returns a pointer to the contained object as a generic void* that can be written to.
Combined button and popup list for selecting options.
Definition qcompare.h:63
GLsizei const GLfloat * v
[13]
GLint GLsizei GLsizei height
GLuint index
[2]
GLdouble GLdouble GLdouble GLdouble top
GLdouble GLdouble right
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
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_FOREIGN(FOREIGN_TYPE)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
QLatin1StringView QLatin1String
Definition qstringfwd.h:31
#define Q_PROPERTY(...)
#define Q_REVISION(...)
#define Q_INVOKABLE
#define Q_GADGET
unsigned long long quint64
Definition qtypes.h:61
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
Q_INVOKABLE QString toString() const
static QPersistentModelIndex toPersistentModelIndex(const QModelIndex &index)
Q_REVISION(6, 7) Q_INVOKABLE QVariant data(int role