[Interest] Qt Quick UI Forms & item views: best practices

Alexander Ivash elderorb at gmail.com
Tue Jan 20 19:31:42 CET 2015


I was trying to apply new feature (Qt Quick UI Forms) to like to create a
custom ListView with a custom delegate, but quickly found that I'm not sure
how to propagate signal from delegate to ListView to expose it as the part
of custom ListView's API.

Probably I'm missing something, but what is the best practices on using Qt
Quick UI Forms together with item views? It seems for me like currently
only ListView itself can be defined inside the *.ui.qml file, and the
delegate needs to be defined inside the corresponding *.qml file. Which
significantly decreases benefits of the whole approach.

Here is the short sample of what I'm trying to achieve:

Customlistview.ui.qml:

CustomListViewForm {
id: root
signal itemClicked(item)
.....
delegate: Rectangle {
....
MouseArea {
onClicked: root.onClicked(root.model.get(index)); /// this line makes
QtCreator unhappy :(
}
}
}


Customlistview.qml:

CustomViewForm {
   onItemClicked: {
        ....
   }
}

Any ideas/suggestions? Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150120/76e1c3d9/attachment.html>


More information about the Interest mailing list