Monday, November 11, 2013

QtQuick.Controls example, ProgressBar.

qml example to implement QtQuick.Controls ProgressBar.

QtQuick.Controls ProgressBar
QtQuick.Controls ProgressBar

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{

        ProgressBar{
            id: progressBar1
            maximumValue: 100
            minimumValue: 0
            value: 50
        }
        ProgressBar{
            id: progressBar2
            maximumValue: 100
            minimumValue: 0
            value: 50
            indeterminate: true
        }
        ProgressBar{
            id: progressBar3
            maximumValue: 100
            minimumValue: 0
            value: 50
            orientation: Qt.Vertical
        }

        Button {
            id: buttonInc
            text: "+10"
            onClicked: {
                progressBar1.value += 10
                progressBar2.value += 10
                progressBar3.value += 10
            }
        }
        Button {
            id: buttonDec
            text: "-10"
            onClicked: {
                progressBar1.value -= 10
                progressBar2.value -= 10
                progressBar3.value -= 10
            }
        }

    }
}