I am having a similar issue.

Qt Code:
  1. --- mainwindow.cpp ----
  2.  
  3. this->drive_ = new Drive(driveName, this);
  4. this->ui->tableView->setModel(this->drive_);
  5. this->ui->treeView->setModel(this->drive_->tagTree_);
  6.  
  7. QObject::connect(this->ui->treeView,SIGNAL(clicked(const QModelIndex&)),
  8. this,SLOT(recalculate()));
  9. QObject::connect(this->ui->treeView,SIGNAL(viewReleased()),
  10. this->ui->tableView,SLOT(reset()));
  11. QObject::connect(this->ui->treeView,SIGNAL(viewReleased()),
  12. this->ui->tableView,SLOT(scrollToTop()));
  13.  
  14. ... unrelated code ...
  15.  
  16. void MainWindow::recalculate() {
  17. QModelIndexList selection = this->ui->treeView->selectionModel()->selectedIndexes();
  18. this->drive_->recalculate(selection);
  19. }
  20.  
  21.  
  22.  
  23. --- drive.cpp ----
  24.  
  25. int Drive::rowCount(const QModelIndex &parent) const {
  26. return results_.size();
  27. }
To copy to clipboard, switch view to plain text mode 

recalculate() is called whenever a new item in the treeView is clicked. It changes the underlying model for the tableView at which point its reset() and scrollToTop() slots are called.

Say, for example, there are 25 items in the view before recalculate is called. If the result of the recalculation has 5 items, the tableView will show the information for the 5 items in the model and 20 empty rows. Apparently the reset doesn't remove those rows. Is there any way for these rows to be removed?

rowCount() is defined as the size of the set of results returned by a recalculation.

Thanks!