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