【发布时间】:2020-01-31 10:12:40
【问题描述】:
如果 itemSwitch1 为“ON”,我想让 itemSwitch2 不可选 我怎样才能拒绝访问 itemSwitch2
function setSelectable(item, state)
{
item.editable = state
}
StyledComboBox {
id: itemSwitch1
Layout.row: 0
Layout.column: 1
model: ["ON", "OFF"]
currentIndex: (root.systemInfo.itemEn) ? 0 : 1
onUpDownPressed:
{
currentIndex = !currentIndex;
}
onEditFinished: {
dashboard.setSelectibale(itemSwitch2, false)
optionProvider.upDate(currentIndexItem.text)
itemLabel1.focus = true;
updateTimer.running = true;
}
}
【问题讨论】:
-
我认为你可以使用
enabled -
我尝试将启用设置为“false”,但该项目仍然可选择!
-
请分享一个最小的工作示例,以便其他 stack-overflowers 可以尝试复制和帮助
-
不,不是真的!,事实上,如果 itemSwitch1.text 为“ON”,则希望禁用 itemSwitch2 的选择