【发布时间】:2021-01-28 21:10:00
【问题描述】:
这是我的代码:
main.qml
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Scroll")
Button {
id:btn
x : 100
y : 100
text: "Click Her to check one of the checkbox! "
}
ScrollView {
width: 40
height: parent.height
ListView {
id : view
width: parent.width
leftMargin: 5
model: 20
delegate:
MyCheckBox {
}
}
}
}
MyCheckBox.qml
CheckBox {
id : chk
width: 25
height: 25
}
我想用 OnClicked 按钮检查复选框(例如,当我单击时,我检查 ItemAtIndex 2),为此我需要访问我的列表视图的对象,自 QT 5.13 起就有一个可用的功能项目 itemAtIndex(int index) 但我使用的是 QT 5.12,还有其他方法吗?感谢您的帮助
【问题讨论】:
标签: javascript qt qml qt5