我有一個專案,我已經把它變成了一個帶有基于不同狀態的影片的按鈕。問題是,有時該按鈕將被禁用,然后我希望它具有半透明的前景色,以基本上將其遮蔽并表示該按鈕已禁用。有沒有辦法對 QML 專案做到這一點?
uj5u.com熱心網友回復:
如果我正確理解您的問題,您只需要添加一個僅在您的按鈕被禁用時才可見的矩形。
Item {
id: button
Rectangle {
anchors.fill: parent
color: "red"
opacity: 0.3
z: 2 // <-- Make sure it stays on top of the rest of the content
visible: !button.enabled
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/354360.html
