I'm trying to dynamically remove/delete rows from a QGridLayout, but I can't seem to get the rowCount() property to update. This is what I'm trying:

Qt Code:
  1. qDebug()<<"Before: "<<my_grid_layout->rowCount();
  2.  
  3. QLayoutItem *child = my_grid_layout->takeAt(row_index);
  4.  
  5. my_grid_layout->removeItem(child);
  6. my_grid_layout->removeWidget(child->widget());
  7.  
  8. delete child->widget();
  9. delete child;
  10.  
  11. my_grid_layout->update();
  12.  
  13. qDebug()<<"After: "<<my_grid_layout->rowCount();
To copy to clipboard, switch view to plain text mode