Sunday, November 17, 2013

QtQuick.Controls example, Slider.

qml example to implement QtQuick.Controls Slider.

QtQuick.Controls Slider
QtQuick.Controls Slider

import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Window 2.0

ApplicationWindow {
    title: qsTr("qteveloper.blogspot.com")
    width: 400
    height: 350

    menuBar: MenuBar {
        Menu {
            title: qsTr("File")
            MenuItem {
                text: qsTr("Exit")
                onTriggered: Qt.quit();
            }
        }
    }

    Column{

        Label {
            id: label
        }

        Slider{
            id: slider1
            maximumValue: 100
            minimumValue: 0
            value: 50
            onValueChanged: label.text = "slider1: " + value
        }
        Slider{
            id: slider2
            maximumValue: 100
            minimumValue: 0
            value: 50
            stepSize: 10
            onValueChanged: label.text = "slider2: " + value
        }
        Slider{
            id: slider3
            maximumValue: 100
            minimumValue: 0
            value: 50
            stepSize: 25
            orientation: Qt.Vertical
            onValueChanged: label.text = "slider3: " + value
        }
    }
}