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
qqmlexpression.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 QQMLEXPRESSION_H
5#define QQMLEXPRESSION_H
6
7#include <QtQml/qqmlerror.h>
8#include <QtQml/qqmlscriptstring.h>
9
10#include <QtCore/qobject.h>
11#include <QtCore/qvariant.h>
12
14
15
16class QString;
17class QQmlEngine;
18class QQmlContext;
20class QQmlContextData;
21class Q_QML_EXPORT QQmlExpression : public QObject
22{
24public:
26 QQmlExpression(QQmlContext *, QObject *, const QString &, QObject * = nullptr);
27 explicit QQmlExpression(const QQmlScriptString &, QQmlContext * = nullptr, QObject * = nullptr, QObject * = nullptr);
28 ~QQmlExpression() override;
29
30 QQmlEngine *engine() const;
31 QQmlContext *context() const;
32
33 QString expression() const;
34 void setExpression(const QString &);
35
36 bool notifyOnValueChanged() const;
37 void setNotifyOnValueChanged(bool);
38
39 QString sourceFile() const;
40 int lineNumber() const;
41 int columnNumber() const;
42 void setSourceLocation(const QString &fileName, int line, int column = 0);
43
44 QObject *scopeObject() const;
45
46 bool hasError() const;
47 void clearError();
48 QQmlError error() const;
49
50 QVariant evaluate(bool *valueIsUndefined = nullptr);
51
54
55private:
57
58 Q_DISABLE_COPY(QQmlExpression)
59 Q_DECLARE_PRIVATE(QQmlExpression)
60 friend class QQmlDebugger;
61 friend class QQmlContext;
62};
63
65
66#endif // QQMLEXPRESSION_H
67
\inmodule QtCore
Definition qobject.h:103
The QQmlContext class defines a context within a QML engine.
Definition qqmlcontext.h:25
The QQmlEngine class provides an environment for instantiating QML components.
Definition qqmlengine.h:57
The QQmlError class encapsulates a QML error.
Definition qqmlerror.h:18
The QQmlExpression class evaluates JavaScript in a QML context.
void valueChanged()
Emitted each time the expression value changes from the last time it was evaluated.
The QQmlScriptString class encapsulates a script and its context.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
static void * context
DBusConnection const char DBusError * error
GLenum GLenum GLsizei void GLsizei void * column
#define Q_OBJECT
#define Q_SIGNALS
engine evaluate("var myObject = new MyObject()")
[8]
QJSEngine engine
[0]