Pass list of lists from qt to qml



  • I need to pass two-dimensional list of data to qml and display it in Table in qml.

    I tried to use this:
    @
    Q_PROPERTY(QList<QVariant> valuesList READ valuesList NOTIFY valuesListChanged)@

    and in the qml file:
    @...
    ListView
    {
    id: dataList
    anchors.fill: parent
    model: numOfRows //I know this parameter
    clip: true
    boundsBehavior: Flickable.StopAtBounds
    delegate: RowDelegate
    {
    }

    }
    

    ...
    RowDelegate.qml

    Rectangle
    {
    height: __itemHeight
    width: ListView.view.width
    border.color: "black"

    property variant rowValuesList: backendList.valuesList[index]  // from qt object
    
    Column
    {
        anchors.fill: parent
        Repeater
        {
            model: numOfColumns //I know this parameter
            Text
            {
                width: __itemWidth
                height: parent.height
                text:  rowValuesList[index]
            }
       }
    

    }
    @

    but it does not work ....

    how can I use this correctly?


Log in to reply
 

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