PDA

View Full Version : QTableWidget test if the cell or item are empty



jaca
31st December 2007, 01:07
Hi!
I using Qt version 4.3.2.
How I make to test if the fields (cell or item) of QTableWidget are empty?
I made the test thus: testing row =0; and column = 0;



tableWidget = new QTableWidget(this);
tableWidget->setRowCount(3);
tableWidget->setColumnCount(3);

if (tableWidget->item(0,0)->text().isEmpty())
{
...
}


but without success.

jpn
31st December 2007, 05:36
There are no items in cells until one sets them with QTableWidget::setItem() or after user has edited them.



QTableWidgetItem* item = tableWidget->item(0,0);
if (!item || item->text().isEmpty())
{
...
}

jaca
2nd January 2008, 14:47
:D
it functioned very well
Thanks very much.