Qt Creator Documentation 2.8.0

Contents

QML HorizontalSwitchGroup Element

A group of switch buttons in a horizontal layout. More...

Properties

Detailed Description

The HorizontalSwitchGroup type provides a group of image buttons with a text label that can be styled using images and text. Each button has an on and off state and a value that can be assigned to the HorizontalSwitchGroup type.

Here is a simple SwitchGroup:

 import QtQuick 1.1
 import "components"

 HorizontalSwitchGroup {
     id: switch_group2
     textOnColor: "#000000"
     textOffColor: "#000000"
     font.family: "Arial"
     font.pixelSize: 16
     font.bold: false
     value: "0"
     spacing: 4

     model: ListModel {
         ListElement {
             text_on: "On 1"
             image_off: "../images/internal_button_up.bmp"
             val: "1"
             text_off: "Off 1"
             image_on: "../images/internal_button_dn.bmp"
         }

         ListElement {
             text_on: "On 2"
             image_off: "../images/internal_button_up.bmp"
             val: "2"
             text_off: "Off 2"
             image_on: "../images/internal_button_dn.bmp"
         }
     }

     onValueChanged: {
         console.debug(value);
     }
 }

Property Documentation

font : font

The font characteristics of the text for the switch buttons.


spacing : int

The spacing in pixels between each switch button item.


textOffColor : string

The color of the text for the switch button's off state.


textOnColor : string

The color of the text for the switch button's on state.


value : string

A value that can be assigned when a switch within the group is in the on state.