I have a QTableWidget with 3 columns and 1000 rows (depends on the number of fetched items from the database ).
I also have a "Reload" Button to reload all the items from the database.
In "Reload" button, I want to delete all the rows from QTableWidget before loading items from the database.
Deleting all rows from the QTableWidget crashes the application when rowcount = 1. I am using following logic to delete all the rows.
if( ui->tableWidget->rowCount() > 0)
{
ui->tableWidget->setRowCount(0);
}
also tried below logic
while (ui->tableWidget->rowCount() > 0)
{
ui->tableWidget->removeRow(0);
}
My application crashes using either of the logic when rowCount = 1. It happens only when i build my application in release mode while it works fine in debug mode.
Can i get any idea why my application is getting crash.