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
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
4#ifndef QQMLBIND_H
5#define QQMLBIND_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 <private/qtqmlglobal_p.h>
19
20#include <QtQml/qqml.h>
21#include <QtCore/qobject.h>
22
24
25class QQmlBindPrivate;
26class Q_QML_EXPORT QQmlBind : public QObject, public QQmlPropertyValueSource, public QQmlParserStatus
27{
28public:
30 RestoreNone = 0x0,
31 RestoreBinding = 0x1,
32 RestoreValue = 0x2,
33 RestoreBindingOrValue = RestoreBinding | RestoreValue
34 };
35
36private:
38 Q_DECLARE_PRIVATE(QQmlBind)
41 Q_PROPERTY(QObject *target READ object WRITE setObject)
44 Q_PROPERTY(bool when READ when WRITE setWhen)
45 Q_PROPERTY(bool delayed READ delayed WRITE setDelayed REVISION(2, 8))
46 Q_PROPERTY(RestorationMode restoreMode READ restoreMode WRITE setRestoreMode
47 NOTIFY restoreModeChanged REVISION(2, 14))
51 Q_CLASSINFO("ImmediatePropertyNames", "objectName,target,property,value,when,delayed,restoreMode");
52
53public:
54 QQmlBind(QObject *parent=nullptr);
55
56 bool when() const;
57 void setWhen(bool);
58
59 QObject *object();
60 void setObject(QObject *);
61
62 QString property() const;
63 void setProperty(const QString &);
64
65 QVariant value() const;
66 void setValue(const QVariant &);
67
68 bool delayed() const;
69 void setDelayed(bool);
70
71 RestorationMode restoreMode() const;
72 void setRestoreMode(RestorationMode);
73
75 void restoreModeChanged();
76
77protected:
78 void setTarget(const QQmlProperty &) override;
79 void classBegin() override;
80 void componentComplete() override;
81
83 void prepareEval();
84 void eval();
85
87 void targetValueChanged();
88};
89
91
92#endif
\inmodule QtCore
Definition qobject.h:103
The QQmlParserStatus class provides updates on the QML parser state.
The QQmlPropertyValueSource class is an interface for property value sources such as animations and b...
The QQmlProperty class abstracts accessing properties on objects created from QML.
\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]
GLenum target
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_CLASSINFO(name, value)
#define Q_INTERFACES(x)
#define Q_SLOTS
#define Q_SIGNALS
const char property[13]
Definition qwizard.cpp:101
settings setValue("DataPump/bgcolor", color)
args<< 1<< 2;QJSValue threeAgain=fun.call(args);QString fileName="helloworld.qs";QFile scriptFile(fileName);if(!scriptFile.open(QIODevice::ReadOnly)) QTextStream stream(&scriptFile);QString contents=stream.readAll();scriptFile.close();myEngine.evaluate(contents, fileName);myEngine.globalObject().setProperty("myNumber", 123);...QJSValue myNumberPlusOne=myEngine.evaluate("myNumber + 1");QJSValue result=myEngine.evaluate(...);if(result.isError()) qDebug()<< "Uncaught exception at line"<< result.property("lineNumber").toInt()<< ":"<< result.toString();QPushButton *button=new QPushButton;QJSValue scriptButton=myEngine.newQObject(button);myEngine.globalObject().setProperty("button", scriptButton);myEngine.evaluate("button.checkable = true");qDebug()<< scriptButton.property("checkable").toBool();scriptButton.property("show").call();QJSEngine engine;QObject *myQObject=new QObject();myQObject- setProperty)("dynamicProperty", 3)