Having a row in the QTableWidget does not mean that all the columns on the row will have items on them. Items (QTableWidgetItem) have to be explicitly set on the cell(row, column)


Qt Code:
  1. for(int row = 0; row < ui->widget->rowCount(); row++)
  2. {
  3. qDebug() << "Ckeck point X " << row;
  4. QTableWidgetItem *item_test = ui->widget->item(row, 0);
  5. if(item_test != 0) //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  6. {
  7. if(!item_test->text().isEmpty())
  8. {
  9. check_count++;
  10. qDebug() << "Checkpoint y " << row;
  11. }
  12. }
  13. else
  14. {
  15. qDebug() << "Checkpoint z: Item not set " << row; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  16. }
  17. c++;
  18. }
  19. qDebug() << "Check Count" << check_count;
To copy to clipboard, switch view to plain text mode