So, I was trying to solve this and I decided to make a slot returning a bool value whenever the textEdit has suffered changes. As I figured out, I thought of using this as a test whenever the "New action" was triggered. So, after the test, I set the bool value back to false and it's working fine:
void Notepad::on_actionNew_triggered() { if(Notepad::on_textEdit_textChanged()) { ~Notepad::on_textEdit_textChanged(); QMessageBox msgBox; msgBox.setText("Warning!"); msgBox.setInformativeText("Changes were applied to this document."); msgBox.setStandardButtons(QMessageBox::Discard | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Cancel); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Discard: // Don't Save was clicked ui->textEdit->clear(); break; case QMessageBox::Cancel: msgBox.close(); break; default: // should never be reached break; } }else{ui->textEdit->clear();} } bool Notepad::on_textEdit_textChanged() { return true; }