Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlbind_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// Qt-Security score:significant
4
5#ifndef QQMLBIND_H
6#define QQMLBIND_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQmlMeta/qtqmlmetaexports.h>
20
21#include <QtQml/qqml.h>
22#include <QtCore/qobject.h>
23
24QT_BEGIN_NAMESPACE
25
26class QQmlBindPrivate;
27class Q_QMLMETA_EXPORT QQmlBind : public QObject, public QQmlPropertyValueSource, public QQmlParserStatus
28{
29public:
30 enum RestorationMode {
31 RestoreNone = 0x0,
32 RestoreBinding = 0x1,
33 RestoreValue = 0x2,
34 RestoreBindingOrValue = RestoreBinding | RestoreValue
35 };
36
37private:
38 Q_OBJECT
39 Q_DECLARE_PRIVATE(QQmlBind)
40 Q_INTERFACES(QQmlParserStatus)
41 Q_INTERFACES(QQmlPropertyValueSource)
42 Q_PROPERTY(QObject *target READ object WRITE setObject NOTIFY objectChanged)
43 Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY propertyChanged)
44 Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
45 Q_PROPERTY(bool when READ when WRITE setWhen NOTIFY whenChanged)
46 Q_PROPERTY(bool delayed READ delayed WRITE setDelayed NOTIFY delayedChanged REVISION(2, 8))
47 Q_PROPERTY(RestorationMode restoreMode READ restoreMode WRITE setRestoreMode
48 NOTIFY restoreModeChanged REVISION(2, 14))
49 Q_ENUM(RestorationMode)
50 QML_NAMED_ELEMENT(Binding)
51 QML_ADDED_IN_VERSION(2, 0)
52 Q_CLASSINFO("ImmediatePropertyNames", "objectName,target,property,value,when,delayed,restoreMode");
53
54public:
55 QQmlBind(QObject *parent=nullptr);
56 ~QQmlBind();
57
58 bool when() const;
59 void setWhen(bool);
60
61 QObject *object() const;
62 void setObject(QObject *);
63
64 QString property() const;
65 void setProperty(const QString &);
66
67 QVariant value() const;
68 void setValue(const QVariant &);
69
70 bool delayed() const;
71 void setDelayed(bool);
72
73 RestorationMode restoreMode() const;
74 void setRestoreMode(RestorationMode);
75
76Q_SIGNALS:
77 void restoreModeChanged();
78 Q_REVISION(6, 10) void objectChanged();
79 Q_REVISION(6, 10) void propertyChanged();
80 Q_REVISION(6, 10) void valueChanged();
81 Q_REVISION(6, 10) void whenChanged();
82 Q_REVISION(6, 10) void delayedChanged();
83
84protected:
85 void setTarget(const QQmlProperty &) override;
86 void classBegin() override;
87 void componentComplete() override;
88
89private:
90 void prepareEval();
91 void eval();
92
93private Q_SLOTS:
94 void targetValueChanged();
95};
96
97QT_END_NAMESPACE
98
99#endif
void validate(QQmlBind *binding) const
Definition qqmlbind.cpp:358
GeneralizedGroupData generalizedGroupData
Definition qqmlbind.cpp:273
void postEvalEntry(QQmlBindEntry *entry)
QQmlBindEntry * targetEntry()
Definition qqmlbind.cpp:342
void onDelayedValueChanged(QString delayedName)
void decodeBinding(QQmlBind *q, const QString &propertyPrefix, QQmlData::DeferredData *deferredData, const QV4::CompiledData::Binding *binding, QQmlComponentPrivate::ConstructionState *immediateState)
Definition qqmlbind.cpp:962
bool isCurrent(QQmlBindEntry *entry) const
void preEvalEntry(QQmlBindEntry *entry)
void buildBindEntries(QQmlBind *q, QQmlComponentPrivate::DeferredState *deferredState)
void createDelayedValues()
ObjectPropertyValueData objectPropertyValueData
Definition qqmlbind.cpp:274
static void warnIgnoredProperties(QQmlBind *q)
Definition qqmlbind.cpp:327
static void initCreator(QQmlData::DeferredData *deferredData, const QQmlRefPointer< QQmlContextData > &contextData, QQmlComponentPrivate::ConstructionState *immediateState)
Definition qqmlbind.cpp:948
static QQmlAnyBinding createBinding(const QQmlProperty &prop, const QV4::CompiledData::Binding *binding, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &compilationUnit, const QQmlRefPointer< QQmlContextData > &contextData, QObject *scopeObject)
Definition qqmlbind.cpp:917
std::unique_ptr< QQmlPropertyMap > delayedValues
Definition qqmlbind.cpp:234
QVarLengthArray< QQmlBindEntry, 1 > entries
Definition qqmlbind.cpp:229
QPointer< QObject > obj
Definition qqmlbind.cpp:219
QQmlBindEntryKind previousKind
Definition qqmlbind.cpp:206
QQmlBindEntry(const QQmlBindEntry &other)
Definition qqmlbind.cpp:168
QQmlBindEntry & operator=(QQmlBindEntry &&other) noexcept
Definition qqmlbind.cpp:181
QQmlProperty prop
Definition qqmlbind.cpp:204
void setTarget(QQmlBind *q, const QQmlProperty &p)
Definition qqmlbind.cpp:894
QQmlBindEntryKind currentKind
Definition qqmlbind.cpp:205
QQmlBindEntry & operator=(const QQmlBindEntry &other)
Definition qqmlbind.cpp:191
QQmlBindEntryContent current
Definition qqmlbind.cpp:202
QQmlBindEntryContent previous
Definition qqmlbind.cpp:203
void validate(QQmlBind *q) const
Definition qqmlbind.cpp:334
QQmlBindEntry(QQmlBindEntry &&other) noexcept
Definition qqmlbind.cpp:162
QQmlBindEntry()=default
QQmlAnyBinding binding
Definition qqmlbind.cpp:139