Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Pass list of lists from qt to qml
QtWS25 Last Chance

Pass list of lists from qt to qml

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    goli
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved