[Solved] TableModel data not being called?



  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.