Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    [Solved] TableModel data not being called?

    General and Desktop
    1
    1
    3327
    Loading More Posts
    • 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.
    • R
      reactive last edited by

      I have a custom table model that extends QAbstractTableModel.
      I've implemented data(), rowCount() and columnCount() like it says in the documentation.
      I've added my model to the table view with setModel().
      My debug statements are telling me row and column count are called several times,
      but data() is never called. The table remains empty although rowCount() is returning
      values > 0. When I add data to the model I call view.update().

      Any ideas on what I did wrong?

      EDIT: I realized I misundertood the part in the doc about implementing the insert methods for resizable data structures. I thought that was for supporting insertions for the user via the view (which I dont want) and didnt realize it was necessary for the model when it updates itself. I added a call to beginInsertRow and endInsertRow when I add the data to my underlying QList and it worked.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post