examples/QtQuick/qtvideoplayer/qml/videoplayer/Slider.qml

00001 import QtQuick 1.0
00002 
00003 Rectangle {
00004     id: container
00005     property alias position: slider.x
00006     signal sliderMoved
00007     height: 16
00008 
00009     radius: 8
00010     opacity: 0.7
00011     smooth: true
00012     gradient: Gradient {
00013         GradientStop { position: 0.0; color: "gray" }
00014         GradientStop { position: 1.0; color: "white" }
00015     }
00016 
00017     Rectangle {
00018         id: slider
00019         x: 1; y: 1; width: 30; height: 14
00020         radius: 6
00021         smooth: true
00022         gradient: Gradient {
00023             GradientStop { position: 0.0; color: "#424242" }
00024             GradientStop { position: 1.0; color: "black" }
00025         }
00026 
00027         MouseArea {
00028             anchors.fill: parent
00029             anchors.margins: -16 // Increase mouse area a lot outside the slider
00030             drag.target: parent; drag.axis: Drag.XAxis
00031             drag.minimumX: 0; drag.maximumX: container.width - 32
00032             onReleased: {
00033             container.sliderMoved();
00034             }
00035         }
00036     }
00037 }

Generated by  doxygen 1.6.2