Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
Themed View elements define the layout and structure of components. For example, the page element is a top-level element that specifies the size and shape of the view of a component such as Title Bar.
The following tables define each of the Themed View elements together with attributes that may be applied to those elements.
Some attributes are common to all theme elements. Functionality for these attributes are implemented by the ThemeItem class. These attributes are listed below.
Attribute | Description |
---|---|
active | The active state of the element. The value of this may be an expression. See Showing/Hiding Elements. |
expanding | Whether this element may expand to fill any available space. Only applies when element is within a layout element. See the documentation of layout for details. |
interactive | See Interactive Elements. |
message | Sends a specified message to a specified channel or service. Currently only supported for interactive elements through the onlick attribute. See Interactive Elements. |
name | The name of the element. |
rect | The size and position of the element. See Positioning Elements. |
transient | If set to "yes" the item can change. See Showing/Hiding Elements. |
vspath | The valuespace path for which expressions appearing in this element are relative to. See Expressions and Valuespace. |
onclick | Changes the value of attributes when the item is clicked. See Interactive Elements. |
onfocus | Changes the value of attributes when the item has the focus. See Interactive Elements. |
The top-level element. Specifies the size and shape of the view. The page element is implemented by the ThemePageItem class.
Attribute | Description |
---|---|
background | The image used as the background. |
base | The base directory where the image data can be found relative to $QPEDIR/pics. |
keypad | If true, the item is active in keypad mode. |
mask | The mask used to set the widget shape. This is useful for the title and context bar. |
orientation | The page direction ("vertical" or "horizontal"). |
rect | The size of the view. The x and y coordinates are ignored. |
color | See Specifying Colors. |
stretch | The stretch points for the mask. See Stretching Images. |
transparent | Set to "yes" if the page is transparent. |
Draws a rectangle which may be filled. The rect element is implemented by the ThemeRectItem class.
Attribute | Description |
---|---|
alpha | Add an alpha channel with value in the range 0-255 |
brush | The color to fill the interior with. See Specifying Colors. |
color | The color of the line. See Specifying Colors. |
keypad | If true, the item is active in keypad mode. |
transparent | Set to "yes" if the item is transparent. |
The line element is implemented by the ThemeLineItem class.
Attribute | Description |
---|---|
color | The color of the line. See Specifying Colors. |
Displays a string of text to the user.
The text element is implemented by the ThemeTextItem class.
Attribute | Description |
---|---|
align | The text alignment. See Alignment. |
bold | When set to "yes" the text will be bold. |
color | The color of the text. See Specifying Colors. |
elided | Specifies where the ellipsis should appear when displaying a text that doesn't fit. The value can be "left", "middle" or "right". |
font | The font used to display the text. |
format | When set to "RichText" the text will be rendered as richtext (Qt HTML subset). When set to "PlainText" the text will be rendered as plain text. If unspecified, the format will be detected automatically based on the presence of html tags. |
outline | The color to draw the outline around the text. See Specifying Colors. |
shadow | Paints a shadow under the text to make it more visible when the background is textured. The value is a number in the range 0 - 255. |
short | When set to "yes" Qt Extended will supply a short version of the text, for example instead of "3 new messages", only "3" will be set. |
size | The font size in points. |
The text element's content may be a literal string or an expression that returns a string which is used as the text for the element.
<text name="literal">Hello, World!</text> <-- displays Hello, World! <text name="expression">@/My/Valuespace/Path/Text</text> <-- displays the text returned by the valuespace key /My/Valuespace/Path/Text
The image element is implemented by the ThemeImageItem class.
Attribute | Description |
---|---|
alpha | Add an alpha channel with value in the range 0-255. |
color | A color to blend with the image. This allows images to be colored to match the selected color scheme. See Specifying Colors. |
keypad | If true, the item is active in keypad mode. |
orientation | The direction to stretch the image ("vertical" or "horizontal"). |
scale | If set to "yes", scale the image to fit the rect. It is possible to scale in one direction only with "vertical" or "horizontal". |
src | The image to be drawn. This may be a literal reference to a file or an expression returning a string which is a reference to a file. |
stretch | The stretch points for the image. See Stretching Images. |
tile | If set to "yes", tiles the entire rect with the image. This attribute is ignored if scale is set. |
transparent | Set to "yes" if the image is transparent. |
Shows an animation. Animations are costly in CPU and therefore power, so they must be used sparingly and only for transient elements with short active periods. The animation is defined by an image with frames layed out horizontally next to each other.
The anim element is implemented by the ThemeAnimationItem class.
Attribute | Description |
---|---|
alpha | Add an alpha channel with value in the range 0-255. |
color | A color to blend with the animation. This allows images to be colored to match the selected color scheme. See Specifying Colors. |
count | The number of frame in the image. |
delay | The delay between frames. |
loop | The frame to loop back to when the last frame is reached. |
looprev | The frame to loop back to, in reverse order, when the last frame is reached. |
play | Whether the animation should play. The default is "no", but if a literal "yes" is specified the animation starts playing immediately. If an expression is specified, the animation will play whenever the return value of the expression is true. |
scale | If set to "yes", scale the animation to fit the rect. It is possible to scale in one direction only with "vertical" or "horizontal". |
src | The image containing the frames. |
width | The width of a frame. |
Displays an on/off status icon.
The status element is implemented by the ThemeStatusItem class.
Attribute | Description |
---|---|
alphaon | The alpha level of the image in the on state (0-255). |
alphaoff | The alpha level of the image in the off state (0-255). |
coloron | A color to blend with the image in the on state. See Specifying Colors. |
coloroff | A color to blend with the image in the off state. See Specifying Colors. |
imageon | The filename of the image representing the on state. |
imageoff | The filename of the image representing the off state. |
on | Whether the item is on or off. The default is "on", but if a literal "off" is specified the status item is off by default. If an expression is specified, the status item is on when the result of the expression is true and off when the result is false. |
scale | If set to "yes", scale the status to fit the rect. It is possible to scale in one direction only with "vertical" or "horizontal". |
Displays a level such as battery charge. The different levels are represented by an image with frames layed out horizontally next to each other. As the level element is an extension of the anim element, all of anim's attributes also apply.
The level element is implemented by the ThemeLevelItem class.
Attribute | Description |
---|---|
alpha | Add an alpha channel with value in the range 0-255. |
color | A color to blend with the level. This allows images to be colored to match the selected color scheme. See Specifying Colors. |
count | The number of frames. |
delay | The delay between frames. |
loop | The frame to loop back to when the last frame is reached. |
looprev | The frame to loop back to, in reverse order, when the last frame is reached. |
play | Whether the animation should play. The default is "no", but if a literal "yes" is specified the animation starts playing immediately. If an expression is specified, the animation will play whenever the return value of the expression is true. |
max | The maximum value of the level. |
min | The minimum value of the level. |
scale | If set to "yes", scale the animation to fit the rect. It is possible to scale in one direction only with "vertical" or "horizontal". |
src | The image containing the frames for the levels. |
width | The width of a frame. |
Either a literal value or an expression can be specified for the content of the level attribute. If an expression is specified, the return value of the expression is used as the level's current value.
This is a special element which loads a plug-in to do the drawing. This is currently only used to display custom backgrounds in the home screen.
The plugin element is implemented by the ThemePluginItem class.
This element does not do any drawing itself. Its role is to layout its child elements in a horizontal or vertical orientation. The default orientation is horizontal. If any of the child elements are shown/hidden then the remaining children will be laid out again.
The layout element is implemented by the ThemeLayoutItem class.
Attribute | Description |
---|---|
align | Set the alignment of the elements. See Alignment. |
keypad | If true, the item is active in keypad mode. |
orientation | The direction to layout the elements ("vertical" or "horizontal"). |
spacing | The space left between elements. |
stretch | When set to "yes", stretch the elements to use all available space. |
This element will display only one of its children. The children must be transient. The last child that is active will be displayed. All other children will be hidden. This is useful for sharing an area in different states. The exclusive element is implemented by the ThemeExclusiveItem class.
This element groups its children into a logical group. It primary role is to propagate mouse button (or stylus) clicks to all children.
The group element is implemented by the ThemeGroupItem class.
This is a special purpose element. It is a place-holder for a custom widget in the user interface, such as a text input field.
The widget element is implemented by the ThemeWidgetItem class.
This is a special purpose element from the widget element. It contains functionality that extends the widget element to specifically support lists in themeing. template items can be defined under the list element to represent the appearance of the list's items.
The list element is implemented by the ThemeListItem class.
This is a special purpose element. It allows a hiearchy of theme items representing a visual look to be declared without actually creating an instance of them. Then, an actual instance of that hierarchy can be created dynamically and used to draw the visual look to some user interface component eg. a custom widget.
<page> <text>This is my standard theme</text> <image src="hello"/> <template name="button"> <image rect="0,0,0,0" src="buttonbg"/> <text rect="0,0,0,0" align="hcenter,vcenter">Click me.</text> </template> </page>
In the above example a template "button" is defined that declares a visual look consisting of an image and some text. The button template is not drawn as part of the theme, it just exists in its hierarchy as a convenient way to access it. You could create an instance of the "button" template using ThemeTemplateItem::createInstance() and then draw it to a custom widget using ThemedView::paint().
For more information also see the Themed Views: Templates documentation.
Copyright © 2009 Nokia | Trademarks | Qt Extended 4.4.3 |