blob: 3fb89882da1e57faf738762962322fd184837433 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 2.0
QtObject {
// this property can be FStyle, but only if the instance is created in place and not assigned. Otherwise we need to use variant
//property FStyle style
property variant style
property variant styleTarget
onStyleChanged: {
if(style !== undefined && style !== null) {
style.styleUpdated.connect(applyStyle);
applyStyle();
}
}
onStyleTargetChanged: {
applyStyle();
}
function applyStyle()
{
if(style !== undefined && style !== null && styleTarget !== undefined && styleTarget !== null) {
setStyledProperties(style, styleTarget)
}
}
function setStyledProperties(style, target)
{
for(var prop in style) {
// first filter unwanted properties
if(prop !== "objectName" && prop.slice(-7) !== "Changed" ) {
// process only properties owned by style & target
if (target.hasOwnProperty(prop)) {
// assign the value
target[prop] = style[prop];
}
}
}
}
}
|