import QtQuick 2.0 Item { id: rectdrag property string bgImageStyle: systemCtrl.style //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin property int xPosition : (barPoint.x+barPoint.width/2) / ((barBackground_Middle.width-22) / 100) //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end 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 //ADD [2017-3-24] #160052 pengc begin signal sendCancele(); //ADD [2017-3-24] #160052 pengc end signal dragingEnd(); //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin property int totalValue : barBackground_Middle.width-22 //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end //Fod #120136 2016/10/18 cxx Start //property int barScale:0 property double barScale:0 //Fod #120136 2016/10/18 cxx End signal dragingStart(); signal barClicked(); signal moveing(); height: barPoint.height //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin Image{ id:barBackground_Middle //update by zlx 2019/1/24 #319233 x:-6 y:-12//-14//0 width:rectdrag.width//rectdrag.width //source:"qrc:MATERIAL/MATERIAL_M8X_VIDEO_PROGRESS_BG"+bgImageStyle source:"qrc:MATERIAL/MATERIAL_VIDEO_PROGRESS_BG"+bgImageStyle } //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end Image{ id:barBlue_Middle //update by zlx 2019/1/24 #319233 x:5//0 y:2//0 width: barPoint.x+barPoint.width/2-2 //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin //source:"qrc:MATERIAL/MATERIAL_M8X_VIDEO_PROGRESS"+bgImageStyle source:"qrc:MATERIAL/MATERIAL_VIDEO_PROGRESS"+bgImageStyle //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end } Image{ id:barPoint x:-barPoint.width/2+enterValue y:-4 //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin //source:"qrc:MATERIAL/MATERIAL_M8X_VIDEO_PROGRESS_BAR"+bgImageStyle source:"qrc:MATERIAL/MATERIAL_VIDEO_PROGRESS_BAR"+bgImageStyle //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end } HMIMouseArea{ anchors.fill: barPoint //ADD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin anchors.rightMargin: 11//0 anchors.bottomMargin: -13//0 anchors.leftMargin: 11//0 anchors.topMargin: -13//0 //ADD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end enabled: dragflagpress onReleased: { pressflag = false } onPressed: { pressflag = true } onCanceled: { pressflag = false } } HMIMouseArea{ x: 0 y: 0 enabled: dragflag //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin anchors.rightMargin: 11//0 anchors.bottomMargin: -13//0 anchors.leftMargin: 11//0 anchors.topMargin: -13//0 //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end anchors.fill: rectdrag//parent drag.target: barPoint drag.axis: Drag.XAxis drag.minimumX: -barPoint.width/2 //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin drag.maximumX: rectdrag.width-22-barPoint.width/2//rectdrag.width-barPoint.width/2 //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end 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: { //ADD [2017-3-24] #160052 pengc begin sendCancele(); //ADD [2017-3-24] #160052 pengc end //DEL [2017-3-24] #160052 pengc begin //dragingEnd(); //DEL [2017-3-24] #160052 pengc end pressflag = false } } }