I am implementing a QTableview to display a huge amount of data. Instead of showing all at once, I am showing 10000 rows and dynamically adding and subtracting the data from the table. I am facing a problem when deleting the upper rows; the vertical header gets updated, and row numbers get changed. Any way to stop the vertical header from updating.
bool flag = 0;
int last_row = 1000;
int top_row = 0;
int margin = 30;
void DataTable::verticalScrollbarAction(int action) {
if(((this->rowAt(0)) - margin) < top_row && flag == 1)
{
this->getTableModel()->GetData(top_row-101, top_row-1, 0);
this->getTableModel()->removeRows(last_row -101, last_row -1);
last_row -= 100;
top_row -= 100;
}
else if ((this->rowAt(this->height()) + margin) > last_row)
{
flag = 1;
this->getTableModel()->GetData(last_row, last_row+100, 1);
this->getTableModel()->removeRows(0, 100);
last_row += 100;
top_row += 100;
}
}