I have a signal coming from QTableWidget to slot where is the function recalculate(int, int). Based on the user input, the function does some calculations and changes the cell background color.
connect(ui->tableWidget_input, SIGNAL(cellChanged(int, int)), this, SLOT(recalculate(int, int)));
Problem is the cellChanged emits the signal when the background color is changed, I need the signal emission only when the text is changed.
The color change causes the infinite loop like this:
- Users changes the cell value, the signal is emitted.
Recalculate(): When a condition is passed, the background is changed.- When background is changed, Qt thinks the cell was changed and the signal is emitted.
Recalculate(): When a condition is passed, the background is changed.- Again and again into infinity.
Please, do you have any idea how to do signal emission by the text change only - no background color change?