2,新增“Apps”; 3,新增“Common”; 4,新增“FileList”; 5,新增“MediaX”; 6,新增“OpenSource”; 7,新增“Samples”; 8,新增“SoftwareBusinessLines”.
54 lines
1.0 KiB
QML
54 lines
1.0 KiB
QML
import QtQuick 2.0
|
|
|
|
Item {
|
|
width: 400
|
|
height: imgSwitchButton.height
|
|
|
|
property string imgPath: "/qmlimages/off.png"
|
|
property bool isSelected: false
|
|
property alias text: mSwitchName.text
|
|
|
|
signal selected
|
|
|
|
|
|
Row{
|
|
anchors.fill: parent
|
|
|
|
Text {
|
|
|
|
id: mSwitchName
|
|
font.pixelSize: 20
|
|
color: "white"
|
|
}
|
|
|
|
Image {
|
|
anchors.right: parent.right
|
|
width: 50
|
|
height: 30
|
|
id: imgSwitchButton
|
|
source: imgPath
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onClicked: {
|
|
changeSwitchStatus()
|
|
selected(isSelected)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//改变switch按钮的状态
|
|
function changeSwitchStatus(){
|
|
console.log("changeSwitchStatus")
|
|
if (!isSelected){
|
|
imgPath = "/qmlimages/on.png"
|
|
|
|
}else{
|
|
imgPath = "/qmlimages/off.png"
|
|
}
|
|
isSelected = !isSelected
|
|
}
|
|
}
|