Lion King
Lion King

Reputation: 33813

itemChanged signal works when the application startup without change in item

I am useitemChanged(QTableWidgetItem *item) signal, in order to when changing in item, performs something.

The following code is the slot function:

void Widget::on_tableWidget_itemChanged(QTableWidgetItem *item){
  qDebug() << item->text();
}

The problem is : supposed to the previous function be implemented when change in item, and this is already happening, but there is another something wrong happening when the application startup as the following.

"circle"
"Sound"
"57013368"
"17"
"Sound"
"Lion King z"
"Lion King"

itemChanged signal works when the application startup without change in item.
How to solve this problem ?

Upvotes: 0

Views: 315

Answers (1)

eferion
eferion

Reputation: 902

you can disable signals during startup:

widget->blockSignals( true );

// startup code

widget->blockSignals( false );

Upvotes: 2

Related Questions