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
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// Qt-Security score:significant
4
5#ifndef QQMLEXPRESSION_H
6#define QQMLEXPRESSION_H
7
8#include <QtQml/qqmlerror.h>
9#include <QtQml/qqmlscriptstring.h>
10
11#include <QtCore/qobject.h>
12#include <QtCore/qvariant.h>
13
15
16
17class QString;
18class QQmlEngine;
19class QQmlContext;
21class QQmlContextData;
22class Q_QML_EXPORT QQmlExpression : public QObject
23{
24 Q_OBJECT
25public:
26 QQmlExpression();
27 QQmlExpression(QQmlContext *, QObject *, const QString &, QObject * = nullptr);
28 explicit QQmlExpression(const QQmlScriptString &, QQmlContext * = nullptr, QObject * = nullptr, QObject * = nullptr);
29 ~QQmlExpression() override;
30
31 QQmlEngine *engine() const;
32 QQmlContext *context() const;
33
34 QString expression() const;
35 void setExpression(const QString &);
36
37 bool notifyOnValueChanged() const;
38 void setNotifyOnValueChanged(bool);
39
40 QString sourceFile() const;
41 int lineNumber() const;
42 int columnNumber() const;
43 void setSourceLocation(const QString &fileName, int line, int column = 0);
44
45 QObject *scopeObject() const;
46
47 bool hasError() const;
48 void clearError();
49 QQmlError error() const;
50
51 QVariant evaluate(bool *valueIsUndefined = nullptr);
52
53Q_SIGNALS:
54 void valueChanged();
55
56private:
57 QQmlExpression(QQmlExpressionPrivate &dd, QObject *parent);
58
59 Q_DISABLE_COPY(QQmlExpression)
60 Q_DECLARE_PRIVATE(QQmlExpression)
61 friend class QQmlDebugger;
62 friend class QQmlContext;
63};
64
65QT_END_NAMESPACE
66
67#endif // QQMLEXPRESSION_H
The QQmlExpression class evaluates JavaScript in a QML context.
QQmlWatchProxy(int id, QQmlExpression *exp, int debugId, QQmlWatcher *parent=nullptr)
bool removeWatch(int id)
bool addWatch(int id, quint32 objectId)
bool addWatch(int id, quint32 objectId, const QByteArray &property)
Combined button and popup list for selecting options.