hey guys, im programming a little programm with QTableWidget.
But everytime i work with two for loops to get empy Cells etc, my programm crashes with SIGSEGV, i know what it is but i do not know why im getting it.
Example:
I'm trying to search for empty cells:
void MainWindow::checkEmpty()
{
for(int row=0;row<getMaxRow();row++) //getMaxRow returns the rowCount
{
for(int col=0;col<getMaxCol();col++)
{
if(table->item(row,col)->text().isEmpty())
{
item->setText("");
table->setItem(row,col, item);
}
}
}
}
void MainWindow::checkEmpty()
{
for(int row=0;row<getMaxRow();row++) //getMaxRow returns the rowCount
{
for(int col=0;col<getMaxCol();col++)
{
if(table->item(row,col)->text().isEmpty())
{
QTableWidgetItem *item = new QTableWidgetItem;
item->setText("");
table->setItem(row,col, item);
}
}
}
}
To copy to clipboard, switch view to plain text mode
im in my table memory, but everything i launch it my programm crashes..
many times im using this loops and everytime it kills my programm.
i need to search for empy cells, to fill it with "" or a "0", because other functions will crash if in a cell is really nothing.
can someone help me? i have to fill new cells with something like a space or a "0".
Bookmarks