如何将弹出背景颜色设置为透明
how to set popup background color to transparent
我在游戏结束时出现以下弹出窗口:
Popup {
id: popup
anchors.centerIn: parent
Text{
text: "Game Over!!" + "\n\n" + "New High Score: "+ score_val
anchors.centerIn: canvas
color: "grey"
font.pixelSize: 70
font.family: gill.name
}
modal: true
focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
}
一切正常,但是背景是白色的,好像没有背景色属性,怎么办?
您必须将项目设置为 background
属性:
Popup {
id: popup
anchors.centerIn: parent
Text{
text: "Game Over!!" + "\n\n" + "New High Score: "+ score_val
anchors.centerIn: canvas
color: "grey"
font.pixelSize: 70
font.family: gill.name
}
<b>background: Rectangle {
color: "transparent"
border.color: "black"
}</b>
modal: true
focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
}
我在游戏结束时出现以下弹出窗口:
Popup {
id: popup
anchors.centerIn: parent
Text{
text: "Game Over!!" + "\n\n" + "New High Score: "+ score_val
anchors.centerIn: canvas
color: "grey"
font.pixelSize: 70
font.family: gill.name
}
modal: true
focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
}
一切正常,但是背景是白色的,好像没有背景色属性,怎么办?
您必须将项目设置为 background
属性:
Popup {
id: popup
anchors.centerIn: parent
Text{
text: "Game Over!!" + "\n\n" + "New High Score: "+ score_val
anchors.centerIn: canvas
color: "grey"
font.pixelSize: 70
font.family: gill.name
}
<b>background: Rectangle {
color: "transparent"
border.color: "black"
}</b>
modal: true
focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
}