Home:ALL Converter>retrieve the text in a specific cell in a QTableWidget?

retrieve the text in a specific cell in a QTableWidget?

Ask Time:2010-02-05T05:12:23         Author:eyecreate

Json Formatter

I've been trying to use QT4 with a QTableWidget to store data. I seem to be unable to select a cell and get the text out of it and wanted to see why it won't retrieve it.

ui->QTableWidget->item(ui->QTableWidget->rowCount(),0)->setText("");

Author:eyecreate,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/2203268/retrieve-the-text-in-a-specific-cell-in-a-qtablewidget
Kaleb Pederson :

QTableWidget uses indices which are zero based, so qTableWidget->rowCount() is one past the end of your table.\n\nTo iterate over your items and see their text, you could do something like this:\n\n// assuming #include <QtDebug>\nfor (int i=0; i<tableWidget->rowCount(); ++i)\n{\n qDebug() << tableWidget->item(i, 0)->text();\n}\n",
2010-02-04T21:26:10
yy