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. How to update a model so it refreshes all its views?

How to update a model so it refreshes all its views?

Scheduled Pinned Locked Moved Unsolved General and Desktop
model view prog
2 Posts 2 Posters 196 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.
  • J Offline
    J Offline
    jdent
    wrote on last edited by
    #1

    I have a QAbstractTableModel subclass and i want to tell the model that it has been modified so that all its views are refreshed. Currently I have this trick which refreshes but it only refreshes one QTableView:

        model->setData(insertIndex, QVariant(-1), Qt::EditRole);
        ui.tableView->setCurrentIndex(insertIndex);
    

    There must be a more general method at the model level!

    C 1 Reply Last reply
    0
    • J jdent

      I have a QAbstractTableModel subclass and i want to tell the model that it has been modified so that all its views are refreshed. Currently I have this trick which refreshes but it only refreshes one QTableView:

          model->setData(insertIndex, QVariant(-1), Qt::EditRole);
          ui.tableView->setCurrentIndex(insertIndex);
      

      There must be a more general method at the model level!

      C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      Your class implementation of, for example, QAbstractItemModel::setData() should emit the dataChanged() signal. It is all fairly well described in subclassing.

      1 Reply Last reply
      6

      • Login

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