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
qquickdesignersupportpropertychanges.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// Qt-Security score:significant reason:default
4
6
7#include <private/qquickpropertychanges_p.h>
8#include <private/qquickstateoperations_p.h>
9
11
12void QQuickDesignerSupportPropertyChanges::attachToState(QObject *propertyChanges)
13{
14 QQuickPropertyChanges *propertyChange = qobject_cast<QQuickPropertyChanges*>(propertyChanges);
15
16 if (!propertyChange)
17 return;
18
19 propertyChange->attachToState();
20}
21
22QObject *QQuickDesignerSupportPropertyChanges::targetObject(QObject *propertyChanges)
23{
24 QQuickPropertyChanges *propertyChange = qobject_cast<QQuickPropertyChanges*>(propertyChanges);
25
26 if (!propertyChange)
27 return nullptr;
28
29 return propertyChange->object();
30}
31
32void QQuickDesignerSupportPropertyChanges::removeProperty(QObject *propertyChanges, const QQuickDesignerSupport::PropertyName &propertyName)
33{
34 QQuickPropertyChanges *propertyChange = qobject_cast<QQuickPropertyChanges*>(propertyChanges);
35
36 if (!propertyChange)
37 return;
38
39 propertyChange->removeProperty(QString::fromUtf8(propertyName));
40}
41
42QVariant QQuickDesignerSupportPropertyChanges::getProperty(QObject *propertyChanges,
43 const QQuickDesignerSupport::PropertyName &propertyName)
44{
45 QQuickPropertyChanges *propertyChange = qobject_cast<QQuickPropertyChanges*>(propertyChanges);
46
47 if (!propertyChange)
48 return QVariant();
49
50 return propertyChange->property(QString::fromUtf8(propertyName));
51}
52
53void QQuickDesignerSupportPropertyChanges::changeValue(QObject *propertyChanges,
54 const QQuickDesignerSupport::PropertyName &propertyName,
55 const QVariant &value)
56{
57 QQuickPropertyChanges *propertyChange = qobject_cast<QQuickPropertyChanges*>(propertyChanges);
58
59 if (!propertyChange)
60 return;
61
62 propertyChange->changeValue(QString::fromUtf8(propertyName), value);
63}
64
65void QQuickDesignerSupportPropertyChanges::changeExpression(QObject *propertyChanges,
66 const QQuickDesignerSupport::PropertyName &propertyName,
67 const QString &expression)
68{
69 QQuickPropertyChanges *propertyChange = qobject_cast<QQuickPropertyChanges*>(propertyChanges);
70
71 if (!propertyChange)
72 return;
73
74 propertyChange->changeExpression(QString::fromUtf8(propertyName), expression);
75}
76
77QObject *QQuickDesignerSupportPropertyChanges::stateObject(QObject *propertyChanges)
78{
79 QQuickPropertyChanges *propertyChange = qobject_cast<QQuickPropertyChanges*>(propertyChanges);
80
81 if (!propertyChange)
82 return nullptr;
83
84 return propertyChange->state();
85}
86
87bool QQuickDesignerSupportPropertyChanges::isNormalProperty(const QQuickDesignerSupport::PropertyName &propertyName)
88{
89 const QMetaObject *metaObject = &QQuickPropertyChanges::staticMetaObject;
90 return (metaObject->indexOfProperty(propertyName) > 0); // 'restoreEntryValues', 'explicit'
91}
92
93void QQuickDesignerSupportPropertyChanges::detachFromState(QObject *propertyChanges)
94{
95 QQuickPropertyChanges *propertyChange = qobject_cast<QQuickPropertyChanges*>(propertyChanges);
96
97 if (!propertyChange)
98 return;
99
100 propertyChange->detachFromState();
101}
102
103QT_END_NAMESPACE
Combined button and popup list for selecting options.