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
qquickdesignersupportstates.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 <private/qquickstategroup_p.h>
7#include <private/qquickpropertychanges_p.h>
8
10
12{
13 QQuickState *stateObject = qobject_cast<QQuickState*>(object);
14
15 if (!stateObject)
16 return false;
17
18 QQuickStateGroup *stateGroup = stateObject->stateGroup();
19
21
22 return stateObject && stateGroup && stateGroup->state() == property.read();
23}
24
26{
27 QQuickState *stateObject = qobject_cast<QQuickState*>(object);
28
29 if (!stateObject)
30 return;
31
32 QQuickStateGroup *stateGroup = stateObject->stateGroup();
33
35
36 stateGroup->setState(property.read().toString());
37}
38
40{
41 QQuickState *stateObject = qobject_cast<QQuickState*>(object);
42
43 if (!stateObject)
44 return;
45
46 QQuickStateGroup *stateGroup = stateObject->stateGroup();
47
48 if (stateGroup)
49 stateGroup->setState(QString());
50}
51
53 const QQuickDesignerSupport::PropertyName &propertyName,
54 const QVariant &value)
55{
56 QQuickState *stateObject = qobject_cast<QQuickState*>(state);
57
58 if (!stateObject)
59 return false;
60
61 return stateObject->changeValueInRevertList(target, QString::fromUtf8(propertyName), value);
62}
63
65 const QQuickDesignerSupport::PropertyName &propertyName,
66 const QString &expression)
67{
68 QQuickState *stateObject = qobject_cast<QQuickState*>(state);
69
70 if (!stateObject)
71 return false;
72
73 return stateObject->changeValueInRevertList(target, QString::fromUtf8(propertyName), expression);
74}
75
77 const QQuickDesignerSupport::PropertyName &propertyName,
78 const QVariant & /* resetValue */)
79{
80 QQuickState *stateObject = qobject_cast<QQuickState*>(state);
81
82 if (!stateObject)
83 return false;
84
85 return stateObject->removeEntryFromRevertList(target, QString::fromUtf8(propertyName));
86}
87
89
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
Definition qobject.h:103
The QQmlContext class defines a context within a QML engine.
Definition qqmlcontext.h:25
The QQmlProperty class abstracts accessing properties on objects created from QML.
static bool changeValueInRevertList(QObject *state, QObject *target, const QQuickDesignerSupport::PropertyName &propertyName, const QVariant &value)
static bool resetStateProperty(QObject *state, QObject *target, const QQuickDesignerSupport::PropertyName &propertyName, const QVariant &)
static bool isStateActive(QObject *object, QQmlContext *context)
static void deactivateState(QObject *object)
static bool updateStateBinding(QObject *state, QObject *target, const QQuickDesignerSupport::PropertyName &propertyName, const QString &expression)
static void activateState(QObject *object, QQmlContext *context)
void setState(const QString &)
QQuickStateGroup * stateGroup() const
bool removeEntryFromRevertList(QObject *target, const QString &name)
bool changeValueInRevertList(QObject *target, const QString &name, const QVariant &revertValue)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:6018
\inmodule QtCore
Definition qvariant.h:65
else opt state
[0]
Combined button and popup list for selecting options.
static void * context
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum target
QLatin1StringView QLatin1String
Definition qstringfwd.h:31
const char property[13]
Definition qwizard.cpp:101