我有一个问题,我找不到解决方案,我希望你在这里找到它:我做了一个ListView与它的模型和它的委托等等,就像这样:从QML ListView中的TextEdit获取数据
Item {
id: creation; width: parent.width ; height: parent.height
.....
ListView {
id: mainViewLiist
model: CreationModel {id: modelCreation}
delegate: delegateCreation
width: parent.width; height: parent.height; x: -(screen.width * 1.5);
cacheBuffer: 100;
}
}
委托包括文本,文本编辑,等等....这样的事情:
Component {
id: creationDelegate
Item {
id: itemCreate
....
Row {
id: rowSerie
spacing: 5
Text {
id: seriesLabel
text: "Series:"
....
}
TextEdit {
id: seriesTextEdit
text: ""
....
}
}
....
}
....
}
内同一个项目,“创造”中,也有两个按钮的工具栏,东西像这样:
ToolBar { id: toolBarCreation; height: 40;
width: parent.width;
opacity: 1.0
button1Label: "Back"
button2Label: "Create"
onButton1Clicked:
{
...
}
onButton2Clicked:
{
...
}
}
我想要的是:当我点击第二个按钮“创建”时,我只想简单地用console.log(arg1,...)显示在每个项目的TextEdit中称为“seriesTextEdit”的内容在listView中。例如,如果我的列表视图包含10个项目,并且用户在所有项目的所有TexTedit中插入一个值,那么我如何访问这些数据? 非常感谢, Giammarco
大,你非常有帮助,主要是因为我不知道Repeater类,我现在用的中继器。是否有一个与Repeater相同的ListView:positionViewAtIndex?我找不到它。顺便说一下,在PhotoViewer示例中,它们不使用Repeater,但使用ListView,即使它们不可见,项目也不会被销毁。 HMow他们能做到吗?再次感谢您的帮助 – Giammarco 2012-04-20 23:40:59
@Giammarco如果您发现blakharaz的回答正确,请先接受他的回答;) – anticafe 2012-06-06 04:13:44