我是菜鸟,在学习qml, 请问qml中,怎么给Button按钮设置一个背景图片?
//第一种
Button {
y: root.height - height
width: 100
height: 30
Image{
anchors.fill: parent
source: "qrc:///board_2.png"
}
text: "Click me"
onClicked: {
root.btnsig_handling();
}
}
//第二种
Button {
y: root.height - height
width: 100
height: 30
text: "Click me"
iconSource: "qrc:///board_2.png"
onClicked: {
root.btnsig_handling();
}
}
第三种
使用background属性
background: Image{source: image_path}