void MyDialog::OnButtonOk(){ if (...) throw std::logic_error("some error");}
try{ MyDialog dlg(this); dlg.exec();}catch(const std::exception& e){// Вывод сообщения}
void MyDialog::OnOkButtonClick(){ QWidget* propertyControl = lineEdit1; try { businessLogic.setProperty1(lineEdit1->text()); // throws at error propertyControl = lineEdit2; businessLogic.setProperty2(lineEdit2->text()); // throws at error .... } catch (const BusinessLogicError& e) { QMessageBox::warning(... e.what() ...); propertyControl->setFocus(); }}
C++ (Qt)MyDialog dlg(this);while (true) try { dlg.exec(); break; } catch(const std::exception& e) { // Вывод сообщения }}