Slider component example using Qt Quick
This article explains how to use the QML slider with start and stop Button. The example uses a timer to run the slider and buttons are used to start and stop the slider.
Article Metadata
Code Example
Installation file: N/A
Tested with
SDK: Qt SDK 1.1.4
Devices(s): Emulator
Compatibility
Platform(s): Symbian and Meego
Device(s): Symbian device with Qt and Meego
Dependencies: None
Platform Security
Signing Required: Selfsign
Capabilities: None
Article
Keywords: Slider
Created: kkrish
(23 Feb 2012)
Last edited: hamishwillee
(02 Aug 2012)
Code snippets
Slider {
id: slider
maximumValue: 30
minimumValue: 0
stepSize: 1
value: 1
valueIndicatorVisible: true
anchors.centerIn: parent
}
Timer{
id: slidTimer
interval: 1000
running: false
repeat: true
onTriggered: {
console.log("slider.value : " + slider.value )
slider.value = slider.value + 1
}
}
Button{
id: startBtn
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
text: "Start"
onClicked: {
if(startBtn.text == "Start"){
slidTimer.start();
startBtn.text = "Stop"
}
else{
slidTimer.stop();
startBtn.text = "Start"
}
}
}

