So after some research, the reason for this funny behaviour is more or less self evident after reading the documentation:
void QTableWidget::itemChanged ( QTableWidgetItem * item ) [signal] This signal is emitted whenever the data of item has changed.
What is happening is the following:
I call:
itm->setFont(f);
itm->setForeground(Qt::black);
but both of these are translated to "data" changes by Qt, and since I block the signals after these two calls, obviously I get 2 extra rows.
So, put the blockSignals
before the font/color changes and it works.