QML父窗口半透明情况下子窗口不透明

来源:互联网 发布:软件定义存储产品 编辑:程序博客网 时间:2024/05/02 06:47

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属性

0 0
原创粉丝点击