import QtQuick 2.0 import Label 2.0 Item { id:carItem property int carimg: systemCtrl.getCarimgstate() //ADD #137785 2016/12/26 liduo begin property string filePath: USBControl1.usbGetSaveImageUri() //ADD #137785 2016/12/26 liduo end property int imageMode: USBControl1.usbGetSaveImageMode() property int imageRotation: USBControl1.usbGetSaveImageRotation() property string homeBgImage:"" function setImageHeight() { if (carimg==0) { return 414; } else { if (imageRotation == 270 || imageRotation == 90) { return 960; } else { return 480; } } } function setImageWidth() { if (carimg==0) { return 761; } else { if (imageRotation == 270 || imageRotation == 90) { return 480 ; } else { return 960 ; } } } Image { id:car_img x:(imageRotation ==270 || imageRotation == 90) ? 240 : 0 y:(imageRotation ==270 || imageRotation == 90) ? -240 : 0 height: setImageHeight() width: setImageWidth() cache:false horizontalAlignment: { if(imageMode ==0 || imageMode == 1) { Image.AlignHCenter } else if(imageMode == 2) { if (imageRotation == 270 || imageRotation == 180) { Image.AlignRight } else if (imageRotation == 90 || imageRotation == 0) { Image.AlignLeft } else { } } else { Image.AlignHCenter } } verticalAlignment: { if(imageMode ==0 || imageMode == 1) { Image.AlignVCenter } else if(imageMode == 2) { if (imageRotation == 270 || imageRotation == 0) { Image.AlignTop } else if (imageRotation == 90 || imageRotation == 180) { Image.AlignBottom } else { } } else { Image.AlignVCenter } } //FOD #137785 2016/12/26 liduo begin source:carimg==0?homeBgImage:filePath //modify by lium #310375 20181116 //FOD #137785 2016/12/26 liduo end asynchronous:true rotation: imageRotation fillMode: { if (imageMode ==0 ) { Image.Pad } else if (imageMode == 1) { Image.Stretch } else if (imageMode == 2) { Image.Tile } else{ // do nothing } } } Connections{ target: USBControl1 onCarImageChanged:{ //ADD #137785 2016/12/26 liduo begin car_img.source="" car_img.source=tmp systemCtrl.setCarimgstate(1); carimg=1 //car_img.sourceSize.height=480 //ADD [2016-11-14] #126616 pengc begin USBControl1.setUsbImageChangeState(0) //ADD [2016-11-14] #126616 pengc end //modify by Jiyulong for background start 2017/9/25 if (mode == 0) //ԭͼ { car_img.fillMode = Image.Pad; car_img.horizontalAlignment = Image.AlignHCenter car_img.verticalAlignment=Image.AlignVCenter } else if (mode ==1) //À­Éì { car_img.fillMode = Image.Stretch; car_img.horizontalAlignment = Image.AlignHCenter car_img.verticalAlignment=Image.AlignVCenter } else if (mode ==2 ) //ƽÆÌ { //modify by Jiyulong for background end car_img.fillMode = Image.Tile; if (tmpRotation == 270) { car_img.horizontalAlignment = Image.AlignRight car_img.verticalAlignment=Image.AlignTop } else if (tmpRotation == 90) { car_img.horizontalAlignment = Image.AlignLeft car_img.verticalAlignment=Image.AlignBottom } else if (tmpRotation == 180) { car_img.horizontalAlignment = Image.AlignRight car_img.verticalAlignment=Image.AlignBottom } else if (tmpRotation == 0) { car_img.horizontalAlignment = Image.AlignLeft car_img.verticalAlignment=Image.AlignTop } } else { //do nothing } imageRotation = tmpRotation; car_img.rotation = tmpRotation; car_img.height = setImageHeight(); car_img.width = setImageWidth(); if (imageRotation == 270 || imageRotation == 90) { car_img.y = -240; car_img.x = 240; } else { car_img.y = 0; car_img.x = 0; } } } Connections{ target: settingCtrl onPictureDefaultChanged:{ car_img.source=homeBgImage systemCtrl.setCarimgstate(0); carimg=0 car_img.height = setImageHeight(); car_img.width = setImageWidth(); car_img.rotation = 0 car_img.fillMode=Image.PreserveAspectFit car_img.y = 0 car_img.x = 0 } } } //ADD #F0079 2016/11/02 liduo end