[Solved]Custom TableModel and redraw View data

  • Hi everyone!
    I have some raw data, and CustomTableModel which build table from it. Data frequently updated from remote source. Model knows it, and should send some signal to a view for redraw all data. I expect from my model, QSqlTableModel like behavior. Emitting dataChanged() signal has no effect, calling beginInser() and endInsert methods too. Only setModel for a view works for now. I look at QSqlTableModel code but cant figure out how model send update signal to view. Can you tell me please what is right solution of this issue.

    Thank you!

  • Let me close my own question.
    When you add new rows to the model use:
    //Adding new rows
    when you remove rows:
    //Removing rows
    in your case when you reload all data you can use:
    //Removing rows
    Emitting dataChanged() useful if you change value of already existing item

Log in to reply

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