スタイルのエイリアスを定義できないのはなぜですか? 例えば
Button {
property alias color: theText.color
style: ButtonStyle {
label: Text {
id: theThext
}
}
}
を与える
qml無効なエイリアス参照でIDが見つかりません
theText
スタイルのエイリアスを定義できないのはなぜですか? 例えば
Button {
property alias color: theText.color
style: ButtonStyle {
label: Text {
id: theThext
}
}
}
を与える
qml無効なエイリアス参照でIDが見つかりません
theText
この回答と同様に、参照するアイテムがalias動的に読み込まれるためです。のようなスタイル コンポーネントLabelはまさにそれです: Components . Itemこれらは、で実際に読み込まれる実際のスタイルを作成するために使用されるテンプレートですLoader。
デフォルトのフォントサイズで
Button {
property int fontPixelSize: 0
style: ButtonStyle {
label: Text {
font.pixelSize: fontPixelSize ? fontPixelSize : font.pixelSize
text: control.text
}
}