QtQuick 2.0, read a QList<QString> from C++



  • Hi all.

    I'm having some issues with extending QtQuick 2.0 with C++.

    I want to show in a gridview, following this tutorial.
    I've done my changes and I wanna show in the gridview is a QList<QString>.
    I'm not using QQmlListProperty as in the tutorial, because I don't understand, and tried another solution. Also, in help says that is not recommended for production.

    My actual problem is that QML side doesn't know how many elements this QList has. I can see only one element on the gridview, the one I choose with this code:
    @
    text: egcView.allfiles[1]@

    The text to show is correct, if I change the index number I can see the diferent QStrings. So, I need a way to know the size of the list and show all the list.

    Any suggestion?

    Thanks all.



  • Have you tried:
    @egcView.allfiles.length@



  • [quote author="DRAX" date="1368091405"]Have you tried:
    @egcView.allfiles.length@[/quote]

    Thank you for your reply.

    I don't know where is the index iterator o which property.
    In the tutorial seems this task is made by QQmlListProperty. But in my gridview I don't know how to make this index or iterator.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.