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
qquickstatechangescript.cpp
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
5
6#include <qqml.h>
7#include <qqmlcontext.h>
8#include <qqmlexpression.h>
9#include <qqmlinfo.h>
10#include <private/qqmlcontext_p.h>
11#include <private/qqmlproperty_p.h>
12#include <private/qqmlbinding_p.h>
13#include "qquickstate_p_p.h"
14
15#include <QtCore/qdebug.h>
16#include <QtCore/qmath.h>
17
18#include <private/qobject_p.h>
19
21
30
51
57{
58 Q_D(const QQuickStateChangeScript);
59 return d->script;
60}
61
67
76{
77 Q_D(const QQuickStateChangeScript);
78 return d->name;
79}
80
82{
84 d->name = n;
85}
86
88{
90 if (!d->script.isEmpty()) {
91 QQmlExpression expr(d->script);
92 expr.evaluate();
93 if (expr.hasError())
94 qmlWarning(this, expr.error());
95 }
96}
97
99{
100 ActionList rv;
102 a.event = this;
103 rv << a;
104 return rv;
105}
106
111
113
114#include <moc_qquickstatechangescript_p.cpp>
\inmodule QtCore
Definition qobject.h:103
The QQmlExpression class evaluates JavaScript in a QML context.
QQmlError error() const
Return any error from the last call to evaluate().
bool hasError() const
Returns true if the last call to evaluate() resulted in an error, otherwise false.
QVariant evaluate(bool *valueIsUndefined=nullptr)
Evaulates the expression, returning the result of the evaluation, or an invalid QVariant if the expre...
The QQmlScriptString class encapsulates a script and its context.
QQuickStateActionEvent * event
void setScript(const QQmlScriptString &)
EventType type() const override
QQuickStateChangeScript(QObject *parent=nullptr)
\qmltype StateChangeScript \instantiates QQuickStateChangeScript \inqmlmodule QtQuick
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
GLboolean GLboolean GLboolean GLboolean a
[7]
GLfloat n
GLdouble s
[6]
Definition qopenglext.h:235
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)