如何更改按鈕圖示的大小?如果我設定 icon.height 和 icon.width 它會給我這個錯誤:
QML IconLabel:檢測到屬性“icon”的系結回圈
Button {
Layout.preferredHeight: parent.height * 0.2
Layout.preferredWidth: parent.width
Layout.row: 4
Layout.column: 0
Layout.columnSpan: 3
icon.source: "qrc:/media/dazn.png"
icon.height: height
icon.width: width
}
uj5u.com熱心網友回復:
您確實不應該系結到heightand width,因為這些屬性是根據圖示大小加上填充間接計算的,從而導致上述系結回圈。不確定你的確切意圖,但你可以系結Layout.preferredHeight和Layout.preferredWidth
Button {
Layout.preferredHeight: parent.height * 0.2
Layout.preferredWidth: parent.width
Layout.row: 4
Layout.column: 0
Layout.columnSpan: 3
icon.source: "qrc:/media/dazn.png"
icon.height: Layout.preferredHeight
icon.width: Layout.preferredWidth
}
看起來圖示仍然受到一些限制(內部IconLabel)的限制,但是它會變得盡可能大。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/380483.html
上一篇:顫振 火力 條紋
