summaryrefslogtreecommitdiff
path: root/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStyler.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStyler.qml')
-rw-r--r--src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStyler.qml41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStyler.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStyler.qml
new file mode 100644
index 0000000000..3fb89882da
--- /dev/null
+++ b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStyler.qml
@@ -0,0 +1,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];
+ }
+ }
+ }
+ }
+}