How to make QDialogButtonBox NOT close the parent QDialog?

I have a QDialog with QDialogButtonBox widgets and I connected the received button signal to the slot in my QDialog subclass, for example:

void MyDialog::on_buttonBox_accepted() { QString errorString = this->inputErrorString(); if (errorString.isEmpty()) { // Do work here // code code code... this->accept(); } else { QMessageBox::critical(this, tr("Error"), tr("The following input errors have occurred:") + errorString); } } 

However, the dialog closes after the message box is displayed; Obviously, the button automatically connects the received signal to the QDialog input jack (I want to name this slot manually). How can I prevent this, so I can take the manual approach described above?

+4
source share
1 answer

You can implement MyDialog :: accept (). The function is virtual in QDialog .

+14
source

Source: https://habr.com/ru/post/1315873/


All Articles