【发布时间】:2018-12-04 17:20:53
【问题描述】:
我在 qml 中有两个文本项,我想将第一个文本的字体设置为第二个文本的字体。我该怎么做?
例如
Text{
id:t1
//some code
//anchors ..etc
}
Text{
//set font = t1.font or something similar
}
【问题讨论】:
我在 qml 中有两个文本项,我想将第一个文本的字体设置为第二个文本的字体。我该怎么做?
例如
Text{
id:t1
//some code
//anchors ..etc
}
Text{
//set font = t1.font or something similar
}
【问题讨论】:
你快到了,你需要使用冒号:来分配属性:
Text {
id: txt1
font.bold: true
text: "Hello"
}
Text {
id: txt2
font: txt1.font
text: "World"
}
【讨论】: