[Interest] Re : Using QQmlListProperty and QAbstractListModel

BOUCARD Olivier boucard_olivier at yahoo.fr
Fri Apr 6 18:01:47 CEST 2012


Ok I found the problem. I had to declare my property with the full namespace.
By the way, Qt, and more specifically QtCreator, have some issues dealing with namespaces and aliased namespaces.

Olivier.




>________________________________
> De : BOUCARD Olivier <boucard_olivier at yahoo.fr>
>À : Qt Interest List <interest at qt-project.org> 
>Envoyé le : Vendredi 6 avril 2012 13h44
>Objet : [Interest] Using QQmlListProperty and QAbstractListModel
> 
>
>Hi all,
>
>
>I'm trying to use QQmlListProperty with Qt5.
>I''ve followed the QtDeclarative Extending Chapter 5 tutorial, with PieChart and PieSlice, which works.
>I want to fill a custom model from QML with specific items. Maybe there is another way but I didn't found it.
>
> 
>I have a class MyModelItem which extends QObject with some properties.
I have a class MyModel which extends QAbstractListModel with a QQmlListProperty<MyModelItem> property with the proper callbacks.
>
>
>When I try to fill my model from QML with something like this:
>
>
>MyModel {
>items: [
>MyModelItem {
>name: "item 1"
>
>}, 
>MyModelItem {
>name: "item 2" 
>}
>]
>
>}
>
>
>I have the following error: "Cannot assign multiple values to a singular property".
>
>
>What am I doing wrong?
>
>
>Thank you.
>
>
>Olivier.
>
>
>
>_______________________________________________
>Interest mailing list
>Interest at qt-project.org
>http://lists.qt-project.org/mailman/listinfo/interest
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120406/93558cde/attachment.html>


More information about the Interest mailing list