Since: BlackBerry 10.0.0

#include <bb/cascades/SystemDefaults>

Provides access to system defaults for texts and colors.

System defaults are colors, paints, text styles and and other resources used to define the system's look and feel. This class provide high level access to those resources.


At this point the collection of SystemDefaults is very limited and only gives access to a couple of default resources. This makes it difficult to give a really meaningful example. SystemDefaults still serve to train the developer to not have access to the actual color values in the default appearance.

Here's a scenario for where system defaults are useful. In a UI scene, there's a container that the developer wants to color using the same color as labels use for text, for whatever reason. If the actual color of label text would be known, the developer could just set that as the background of his container. However, if the visual appearance is updated (in a new release of the UI framework), his container would no longer have the same color as labels, and his application would be broken. So what he needs to do is:
Container *container = Container::create()

The container will now always have the same color as the default labels.

This example shows how to access SystemDefaults from QML:
Container {
    background: SystemDefaults.Paints.DefaultText

The set of paints and colors in this collection will change.




Provides access to the system's defaults for colors.


Provides access to the system's defaults for text styles.

Last modified: 2014-03-13

comments powered by Disqus