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. [Solved] TableModel data not being called?

[Solved] TableModel data not being called?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 3.5k 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.
  • R Offline
    R Offline
    reactive
    wrote on 29 Mar 2011, 16:08 last edited by
    #1

    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
    0

    1/1

    29 Mar 2011, 16:08

    • Login

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