ContactWindow::ContactWindow()
{
...
connect(ui
->first_name_edit,
SIGNAL(textEdited
(QString)),
this,
SLOT(registerChange
()));
connect(ui
->last_name_edit,
SIGNAL(textEdited
(QString)),
this,
SLOT(registerChange
()));
connect(ui
->email_edit,
SIGNAL(textEdited
(QString)),
this,
SLOT(registerChange
()));
connect(ui->notes_edit, SIGNAL(textChanged()), this, SLOT(registerChange()));
...
}
void ContactWindow::populateData()
{
// Block signals while setting
this->blockSignals(true);
// Populate UI fields
ui->first_name_edit->setText(current_contact.first_name);
ui->last_name_edit->setText(current_contact.last_name);
ui->email_edit->setText(current_contact.email);
ui->notes_edit->setText(current_contact.notes); // This signal still gets caught.
// Unblock signals
this->blockSignals(false);
}
ContactWindow::ContactWindow()
{
...
connect(ui->first_name_edit, SIGNAL(textEdited(QString)), this, SLOT(registerChange()));
connect(ui->last_name_edit, SIGNAL(textEdited(QString)), this, SLOT(registerChange()));
connect(ui->email_edit, SIGNAL(textEdited(QString)), this, SLOT(registerChange()));
connect(ui->notes_edit, SIGNAL(textChanged()), this, SLOT(registerChange()));
...
}
void ContactWindow::populateData()
{
// Block signals while setting
this->blockSignals(true);
// Populate UI fields
ui->first_name_edit->setText(current_contact.first_name);
ui->last_name_edit->setText(current_contact.last_name);
ui->email_edit->setText(current_contact.email);
ui->notes_edit->setText(current_contact.notes); // This signal still gets caught.
// Unblock signals
this->blockSignals(false);
}
To copy to clipboard, switch view to plain text mode
Bookmarks