我有一个TextField
我想有条件地显示或隐藏背景的地方。这是一个带有背景的文本字段:
TextField {
id: with_background
}
这是一个没有:
TextField {
id: without_background
background: null
}
我尝试有条件地将背景设置为undefined
,但这不起作用:
TextField {
background: row.activeFocus ? TextField.background : null;
}
这在 QML 中是否可行?