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
qqmldelegatecomponent_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 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 QQMLDELEGATECOMPONENT_P_H
5#define QQMLDELEGATECOMPONENT_P_H
6
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtQmlModels/private/qtqmlmodelsglobal_p.h>
21#include <QtQmlModels/private/qqmlabstractdelegatecomponent_p.h>
22#include <QtQml/qqmlcomponent.h>
23
24QT_REQUIRE_CONFIG(qml_delegate_model);
25
27
28class Q_LABSQMLMODELS_EXPORT QQmlDelegateChoice : public QObject
29{
31 Q_PROPERTY(QVariant roleValue READ roleValue WRITE setRoleValue NOTIFY roleValueChanged FINAL)
32 Q_PROPERTY(int row READ row WRITE setRow NOTIFY rowChanged FINAL)
33 Q_PROPERTY(int index READ row WRITE setRow NOTIFY indexChanged FINAL)
34 Q_PROPERTY(int column READ column WRITE setColumn NOTIFY columnChanged FINAL)
35 Q_PROPERTY(QQmlComponent* delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
36 Q_CLASSINFO("DefaultProperty", "delegate")
37 QML_NAMED_ELEMENT(DelegateChoice)
39
40public:
41 QVariant roleValue() const;
42 void setRoleValue(const QVariant &roleValue);
43
44 int row() const;
45 void setRow(int r);
46
47 int column() const;
48 void setColumn(int c);
49
50 QQmlComponent *delegate() const;
51 void setDelegate(QQmlComponent *delegate);
52
53 virtual bool match(int row, int column, const QVariant &value) const;
54
56 void roleValueChanged();
57 void rowChanged();
58 void indexChanged();
59 void columnChanged();
60 void delegateChanged();
61 void changed();
62
64 QVariant m_value;
65 int m_row = -1;
66 int m_column = -1;
67 QQmlComponent *m_delegate = nullptr;
68};
69
70class Q_LABSQMLMODELS_EXPORT QQmlDelegateChooser : public QQmlAbstractDelegateComponent
71{
73 Q_PROPERTY(QString role READ role WRITE setRole NOTIFY roleChanged FINAL)
74 Q_PROPERTY(QQmlListProperty<QQmlDelegateChoice> choices READ choices CONSTANT FINAL)
75 Q_CLASSINFO("DefaultProperty", "choices")
76 QML_NAMED_ELEMENT(DelegateChooser)
78
79public:
80 QString role() const final { return m_role; }
81 void setRole(const QString &role);
82
83 virtual QQmlListProperty<QQmlDelegateChoice> choices();
84 static void choices_append(QQmlListProperty<QQmlDelegateChoice> *, QQmlDelegateChoice *);
85 static qsizetype choices_count(QQmlListProperty<QQmlDelegateChoice> *);
86 static QQmlDelegateChoice *choices_at(QQmlListProperty<QQmlDelegateChoice> *, qsizetype);
87 static void choices_clear(QQmlListProperty<QQmlDelegateChoice> *);
88 static void choices_replace(QQmlListProperty<QQmlDelegateChoice> *, qsizetype,
90 static void choices_removeLast(QQmlListProperty<QQmlDelegateChoice> *);
91
92 QQmlComponent *delegate(QQmlAdaptorModel *adaptorModel, int row, int column = -1) const override;
93
96
97private:
98 QString m_role;
99 QList<QQmlDelegateChoice *> m_choices;
100};
101
103
104#endif // QQMLDELEGATECOMPONENT_P_H
DarwinBluetooth::DeviceInquiryDelegate * m_delegate
\inmodule QtCore
Definition qobject.h:103
The QQmlComponent class encapsulates a QML component definition.
virtual QQmlListProperty< QQmlDelegateChoice > choices()
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint index
[2]
GLboolean r
[2]
GLenum GLenum GLsizei void GLsizei void * column
const GLubyte * c
GLenum GLenum GLsizei void * row
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_CLASSINFO(name, value)
#define Q_SIGNALS
static bool match(const uchar *found, uint foundLen, const char *target, uint targetLen)
ptrdiff_t qsizetype
Definition qtypes.h:165