connect(firstLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(checkEmpty(const QString&)));connect(secondLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(checkEmpty(const QString&)));checkEmpty(const QString& s){ if(firstLineEdit->text().isEmpty()&&secondLineEdit->text().isEmpty()) unionButton->setEnabled(true);}