Error in changing QTableWidget in Qt

283 views Asked by At

I have a QTableWidget and I want to change the text or background color in a certain cell, but it cause an error. I use below code:

MyTableWidget->item(i, j)->setText(QString::number(x));

or

MyTableWidget->item(i, j)->setBackgroundColor(colorX);

Thanks for your help :)

Edit:

For SetText, error is:

The inferior stopped because it received a signal from the Operating System.

Signal name : SIGSEGV

Signal meaning : Segmentation fault

this error is occurred in setData statement (in body of setText).

And for color error is:

"The program has unexpectedly finished."

and program is crashed!

0

There are 0 answers