Zuble QML Types   |  Zuble C++ Classes   |  Table of Contents

ZStyleTarget QML Type

Dynamically updates a set of common style attributes shared by a group of Zuble widgets. More...

Import Statement: import controls .
Inherited By:

ZStyleRectangle and ZStyleText


Detailed Description

ZStyleTarget copies a named subset of property values from a source object (ZScopedMap) containing a dictionary of style name/value pairs into the appropriately named properties on this object. All of the properties defined on the target must belong to the same style group as described below.

Whenever the style source (zStyleSource) signals a property change, ZStyleTarget will copy new values from the source dictionary into extended object's style properties, overwriting the previous contents if a change for that property has occurred.

Item names in the ZScopedMap have the format: "<group>.<propertyName>" where "<group>" names a collection of style properties that are common to a specific object type, the final "." is the property name separator, and "<propertyName>" is the name of the style property on the extended class that is to receive the value from the ZScopedMap dictionary.

Use this object by extending it, defining style properties on the extended class and listing those property names in the zStyleProps array. Styled objects bind to the style properties and update when the source changes. These bindings remain intact even when the source object is switched out for a different source.

Set the zStyleGroup property of extended object to "<group-name>":

zStyleGroup: "my.style.group"

Set the zStyleProps property of extended object to an array of property names to copy from the group:

zStyleProps: ['textColor','textSize','text','bold']

Define the style properties on extended object:

property color textColor: "#DCDCCC" property var textSize: "#DCDCCC" property string text: "#DCDCCC" property bool bold: true

This example would propagate the following style properties from the source into the extended object:

my.style.group.textColor, my.style.group.textSize, my.style.group.text, my.style.group.bold

Property Documentation

zStyleGroup : string

name of the style group in the source for this target

zStyleProps : var

property names of the style group that will be updates whenever they change on the source

zStyleSource : ZScopedMap

map from which style properties will be drawn