Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. trying to use multiple columns with qml Tableview & QAbstractTableModel

trying to use multiple columns with qml Tableview & QAbstractTableModel

Scheduled Pinned Locked Moved QML and Qt Quick
tableviewqabstracttablemqml dynamic
3 Posts 3 Posters 1.8k 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.
  • Z Offline
    Z Offline
    zeryx
    wrote on 12 Jun 2015, 16:43 last edited by zeryx 6 Dec 2015, 16:44
    #1

    Hey guys, I've been trying to figure out how to get my QAbstractTableModel to correctly propegate role data & model data to my tableView in qml. My headers populate properly but nothing else is, any help would be massively appreciated!

    I'm not entirely sure the format for these forums however I hastebined all of my code for readability.

    http://hastebin.com/igoribowux.coffee - main.cpp

    http://hastebin.com/yukuqoweva.vala - tableModel.h

    http://hastebin.com/deyijivago.coffee - tableModel.cpp

    http://hastebin.com/genuhisodu.sm - schedulerViewingPane.qml

    essentially my goal is to have dynamically created vertical columns with mirrored rows, and then pass it through a QSortFilterProxyModel to filter out by column, I think I'm close!

    P 1 Reply Last reply 13 Jun 2015, 05:40
    0
    • Z zeryx
      12 Jun 2015, 16:43

      Hey guys, I've been trying to figure out how to get my QAbstractTableModel to correctly propegate role data & model data to my tableView in qml. My headers populate properly but nothing else is, any help would be massively appreciated!

      I'm not entirely sure the format for these forums however I hastebined all of my code for readability.

      http://hastebin.com/igoribowux.coffee - main.cpp

      http://hastebin.com/yukuqoweva.vala - tableModel.h

      http://hastebin.com/deyijivago.coffee - tableModel.cpp

      http://hastebin.com/genuhisodu.sm - schedulerViewingPane.qml

      essentially my goal is to have dynamically created vertical columns with mirrored rows, and then pass it through a QSortFilterProxyModel to filter out by column, I think I'm close!

      P Offline
      P Offline
      p3c0
      Moderators
      wrote on 13 Jun 2015, 05:40 last edited by
      #2

      Hi @zeryx,
      Does the roles defined in the model and the TableViewColumn match exactly ?

      157

      1 Reply Last reply
      0
      • R Offline
        R Offline
        ramsailesh
        wrote on 15 Jun 2015, 08:11 last edited by ramsailesh
        #3

        Hi @zeryx
        I've tried your code with the change below and it works fine (columns are getting populated at runtime)

        use var headerData = baseTableModel.headerList
        instead of var headerData = headers at line number 11 in schedulerViewingPane.qml (http://hastebin.com/genuhisodu.sm).

        Since you are already passing EmployeeModelTable instance baseTableModel to the qml then why not use the headerList property from the instance instead of setting it again.

        1 Reply Last reply
        0

        1/3

        12 Jun 2015, 16:43

        • Login

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