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
QtWS25 Last Chance

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 last edited by zeryx
    #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!

    p3c0P 1 Reply Last reply
    0
    • Z zeryx

      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!

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on 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 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

        • Login

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