QML的父元素opacity值会被继承,而color不会。故可以在父窗口使用8位color代码,前两位是alphar透明值。
Rectangle{
id:waitingRec
z:100
visible:false
anchors.fill: parent
color:"#50000000"
Component.onCompleted: {
animation.start()
}
Image{
id:rotation
anchors.centerIn: parent
width:80
height:80
source:"image://cmos-settings/icon/loading.png"
RotationAnimation on rotation {
id: animation
loops: Animation.Infinite
from: 0
to: 360
}
}
Text{
anchors.top:rotation.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 15
text:qsTr("Uninstalling...")
color:"black"
font.family: defaultFontFamily
font.pixelSize: 35
style: Text.Outline
styleColor:"white"
}
}
父窗口是黑色半透明铺满全屏,子窗口是不透明的旋转的动画和文字界面。注意父元素的color属性