I have a bunch of UI objects with their signals connected to a `registerChange()` slot. I do not want this slot to be triggered when I am initially populating the existing data, so I use `blockSignals()`. This works great for everything except the QTextEdit object, which still successfully triggers `registerChange()`. Any idea why this would be? If my understanding of `blockSignals` is correct then this shouldn't be possible. Stripped down code for context:
Qt Code:
  1. ContactWindow::ContactWindow()
  2. {
  3. ...
  4. connect(ui->first_name_edit, SIGNAL(textEdited(QString)), this, SLOT(registerChange()));
  5. connect(ui->last_name_edit, SIGNAL(textEdited(QString)), this, SLOT(registerChange()));
  6. connect(ui->email_edit, SIGNAL(textEdited(QString)), this, SLOT(registerChange()));
  7. connect(ui->notes_edit, SIGNAL(textChanged()), this, SLOT(registerChange()));
  8. ...
  9. }
  10.  
  11. void ContactWindow::populateData()
  12. {
  13. // Block signals while setting
  14. this->blockSignals(true);
  15.  
  16. // Populate UI fields
  17. ui->first_name_edit->setText(current_contact.first_name);
  18. ui->last_name_edit->setText(current_contact.last_name);
  19. ui->email_edit->setText(current_contact.email);
  20. ui->notes_edit->setText(current_contact.notes); // This signal still gets caught.
  21.  
  22. // Unblock signals
  23. this->blockSignals(false);
  24. }
To copy to clipboard, switch view to plain text mode