Hmm, I can't see a problem there which could cause a crash..
You still should check the value if ok was even pressed, though, and only change the size when appropriate..
bool ok = false;
if(ok)
{
demands->setRowCount(tableSize);
demands->setColumnCount(tableSize);
}
bool ok = false;
tableSize = QInputDialog::getInteger(...);
if(ok)
{
demands->setRowCount(tableSize);
demands->setColumnCount(tableSize);
}
To copy to clipboard, switch view to plain text mode
But anyway, that's not causing a crash. You seem to be forcing the integer value between 0-100, which is ok, and QTableWidget has a check for negative values so that's not the case either.. So I can't say..
Maybe the problem lies somewhere else?
Edit: Erm... what's that label doing there? I see it's adapted from the example piece of code in docs..
But you are allocating a new label each time the size is changed. Instantiate the label somewhere else, and only change it's value here..
Bookmarks