我正在尝试读入并将表中的所有行存储到QVariant列表中,但每次运行程序时都会存储数据崩溃。我知道它存储数据因为qDebug()但在完成循环后程序崩溃。我的代码如下。
int RowNumber = ui->tableWidget_Invoice->rowCount();
for(int y = 0; y<=RowNumber; y++)
{
Qty << ui->tableWidget_Invoice->item(y, 0)->text();
Description << ui->tableWidget_Invoice->item(y, 1)->text();
Product_CODE << ui->tableWidget_Invoice->item(y, 2)->text();
Unit_Price << ui->tableWidget_Invoice->item(y, 3)->text();
Total_Price << ui->tableWidget_Invoice->item(y, 4)->text();
}