[Solved] How to insert data to qtablewidget?
-
the program creates rows and columns but no data is inserted
what am i missing?@
void MainWindow::errorString(QString err)
{
ui->tableWidget->setRowCount(current_row+1);
ui->tableWidget->setColumnCount(5);
current_row++;switch(err[3].toLatin1()) { case 'B': { address_selection(err); ui->tableWidget->setItem(current_row,0, new QTableWidgetItem(err)); //ui->tableWidget->setItem(current_row,0,new QTableWidgetItem("x")); } break;
}
}@ -
Let say current_row = 9. You set rowCount = 10, so table indexes are 0..9. Then you increment current_row and set data for row 10 which is out of table index.
-
thanks got it.