import QtQuick 2.0 Item { id: rectdrag property string bgImageStyle: acCtrl.style property int xPosition : (barPoint.x+barPoint.width/2) / (barBackground_Middle.width / 100) property int enterValue property int exportValue : barPoint.x+barPoint.width/2 property alias barBackgroundMiddlewidth:barBackground_Middle.width property alias barBackgroundMiddleSource: barBackground_Middle.source property alias barBlueMiddleSource: barBlue_Middle.source property alias barPointSource: barPoint.source property bool pressflag: false property bool dragflag: false property bool dragflagpress: false property alias barBackgroundMiddleheight: barBackground_Middle.height property alias barPointwidth: barPoint.width property alias barPointheight: barPoint.height signal dragingEnd(); property int totalValue : barBackground_Middle.width property int barScale:0 signal dragingStart(); signal barClicked(); signal moveing(); height: barPoint.height Image{ id:barBackground_Middle x:0 y:0 width:rectdrag.width source:"qrc:MATERIAL/MATERIAL_M8X_VIDEO_PROGRESS_BG"+bgImageStyle } Image{ id:barBlue_Middle x:0 y:0 width: barPoint.x+barPoint.width/2-2 source:"qrc:MATERIAL/MATERIAL_M8X_VIDEO_PROGRESS"+bgImageStyle } Image{ id:barPoint x:-barPoint.width/2+enterValue y:-4 source:"qrc:MATERIAL/MATERIAL_M8X_VIDEO_PROGRESS_BAR"+bgImageStyle } HMIMouseArea{ anchors.fill: barPoint enabled: dragflagpress onReleased: { pressflag = false } onPressed: { pressflag = true } onCanceled: { pressflag = false } } HMIMouseArea{ x: 0 y: 0 enabled: dragflag anchors.rightMargin: 0 anchors.bottomMargin: 0 anchors.leftMargin: 0 anchors.topMargin: 0 anchors.fill: rectdrag//parent drag.target: barPoint drag.axis: Drag.XAxis drag.minimumX: -barPoint.width/2 drag.maximumX: rectdrag.width-barPoint.width/2 onMouseXChanged: { enterValue = barPoint.x +barPoint.width/2 barScale = (enterValue*100)/totalValue; moveing(); } onReleased: { dragingEnd(); pressflag = false } onPressed: { enterValue = mouseX barScale = (enterValue*100)/totalValue; dragingStart(); pressflag = true } onCanceled: { dragingEnd(); pressflag = false } } }