Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qqmlproperty_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 QQMLPROPERTY_P_H
5#define QQMLPROPERTY_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 "qqmlproperty.h"
19
20#include <private/qobject_p.h>
21#include <private/qqmlcontextdata_p.h>
22#include <private/qqmlpropertydata_p.h>
23#include <private/qqmlpropertyindex_p.h>
24#include <private/qqmlrefcount_p.h>
25#include <private/qtqmlglobal_p.h>
26
27#include <QtQml/qqmlengine.h>
28
30
31class QQmlContext;
34class QQmlMetaObject;
37
38class Q_QML_PRIVATE_EXPORT QQmlPropertyPrivate final : public QQmlRefCounted<QQmlPropertyPrivate>
39{
40public:
41 enum class InitFlag {
42 None = 0x0,
43 AllowId = 0x1,
44 AllowSignal = 0x2
45 };
47
51
54
56
57 // ### Qt7: Get rid of this.
58 static bool resolveUrlsOnAssignment();
59
61
63 { return encodedIndex(core, valueTypeData); }
64 static QQmlPropertyIndex encodedIndex(const QQmlPropertyData &core, const QQmlPropertyData &valueTypeData)
65 { return QQmlPropertyIndex(core.coreIndex(), valueTypeData.coreIndex()); }
66
67 QQmlRefPointer<QQmlContextData> effectiveContext() const;
68
69 void initProperty(QObject *obj, const QString &name, InitFlags flags = InitFlag::None);
70 void initDefault(QObject *obj);
71
72 bool isValueType() const;
73 QMetaType propertyType() const;
75 QQmlProperty::PropertyTypeCategory propertyTypeCategory() const;
76
77 QVariant readValueProperty();
78 bool writeValueProperty(const QVariant &, QQmlPropertyData::WriteFlags);
79
80 static QQmlMetaObject rawMetaObjectForType(QMetaType metaType);
81 static bool writeEnumProperty(const QMetaProperty &prop, int idx, QObject *object,
82 const QVariant &value, int flags);
83 static bool writeValueProperty(QObject *,
84 const QQmlPropertyData &, const QQmlPropertyData &valueTypeData,
86 QQmlPropertyData::WriteFlags flags = {});
87 static bool resetValueProperty(QObject *,
88 const QQmlPropertyData &, const QQmlPropertyData &valueTypeData,
90 QQmlPropertyData::WriteFlags flags = {});
91 static bool write(QObject *, const QQmlPropertyData &, const QVariant &,
93 QQmlPropertyData::WriteFlags flags = {});
94 static bool reset(QObject *, const QQmlPropertyData &,
95 QQmlPropertyData::WriteFlags flags = {});
96 static void findAliasTarget(QObject *, QQmlPropertyIndex, QObject **, QQmlPropertyIndex *);
97
99 {
102 };
108 static ResolvedAlias findAliasTarget(QObject *baseObject, QQmlPropertyIndex baseIndex);
109
111 None = 0,
112 DontEnable = 0x1
113 };
114 Q_DECLARE_FLAGS(BindingFlags, BindingFlag)
115
116 static void setBinding(QQmlAbstractBinding *binding, BindingFlags flags = None,
117 QQmlPropertyData::WriteFlags writeFlags = QQmlPropertyData::DontRemoveBinding);
118
119 static void removeBinding(const QQmlProperty &that);
120 static void removeBinding(QObject *o, QQmlPropertyIndex index);
121 static void removeBinding(QQmlAbstractBinding *b);
123
124 static QQmlProperty restore(QObject *, const QQmlPropertyData &, const QQmlPropertyData *,
126
127 int signalIndex() const;
128
129 static inline QQmlPropertyPrivate *get(const QQmlProperty &p) { return p.d; }
130
131 // "Public" (to QML) methods
132 static QQmlAbstractBinding *binding(const QQmlProperty &that);
133 static void setBinding(const QQmlProperty &that, QQmlAbstractBinding *);
134 static QQmlBoundSignalExpression *signalExpression(const QQmlProperty &that);
135 static void setSignalExpression(const QQmlProperty &that, QQmlBoundSignalExpression *);
136 static void takeSignalExpression(const QQmlProperty &that, QQmlBoundSignalExpression *);
137 static bool write(const QQmlProperty &that, const QVariant &, QQmlPropertyData::WriteFlags);
138 static QQmlPropertyIndex propertyIndex(const QQmlProperty &that);
139 static QMetaMethod findSignalByName(const QMetaObject *mo, const QByteArray &);
140 static QMetaProperty findPropertyByName(const QMetaObject *mo, const QByteArray &);
141 static bool connect(const QObject *sender, int signal_index,
142 const QObject *receiver, int method_index,
143 int type = 0, int *types = nullptr);
144 static void flushSignal(const QObject *sender, int signal_index);
145
146 static QList<QUrl> urlSequence(const QVariant &value);
147 static QList<QUrl> urlSequence(
149 static QQmlProperty create(
150 QObject *target, const QString &propertyName,
152 QQmlPropertyPrivate::InitFlags flags);
153
154};
155
156Q_DECLARE_OPERATORS_FOR_FLAGS(QQmlPropertyPrivate::BindingFlags)
158
160
161#endif // QQMLPROPERTY_P_H
\inmodule QtCore
Definition qbytearray.h:57
Definition qlist.h:74
\inmodule QtCore
Definition qmetaobject.h:18
\inmodule QtCore
\inmodule QtCore
Definition qmetatype.h:320
\inmodule QtCore
Definition qobject.h:90
\inmodule QtCore
Definition qpointer.h:18
The QQmlContext class defines a context within a QML engine.
Definition qqmlcontext.h:25
QQmlPropertyData core
QQmlPropertyIndex encodedIndex() const
QQmlPropertyData valueTypeData
static QQmlPropertyPrivate * get(const QQmlProperty &p)
Q_DECLARE_FLAGS(InitFlags, InitFlag)
QQmlRefPointer< QQmlContextData > context
static QQmlPropertyIndex encodedIndex(const QQmlPropertyData &core, const QQmlPropertyData &valueTypeData)
QPointer< QQmlEngine > engine
QPointer< QObject > object
The QQmlProperty class abstracts accessing properties on objects created from QML.
Type
This enum specifies a type of QML property.
PropertyTypeCategory
This enum specifies a category of QML property.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtCore
Definition qvariant.h:64
static void writeFlags(QTextStream &stream, const Provider &provider)
Definition ctf.cpp:269
auto signalIndex
auto mo
[7]
Combined button and popup list for selecting options.
static void * context
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
GLboolean GLboolean GLboolean b
GLuint index
[2]
GLsizei GLenum GLenum * types
GLenum type
GLenum target
GLbitfield flags
GLuint name
GLhandleARB obj
[2]
GLboolean reset
GLfloat GLfloat p
[1]
gzip write("uncompressed data")
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
view create()
\inmodule QtCore