I have an application that is used to manage a barracks in my city, on the sniper register screen I would like to check first if there is a group registered in the database, if I do not close the dialog, I tried to do this way:
void CadastrarAtirador::showEvent(QShowEvent *ev)
{
QDialog::showEvent(ev);
if(turma->anos().isEmpty()){
this->close();
}
}
The error message for the user is displayed normally, but then a blank dialog is shown and when it is closed the program launches an assert:
Falha ao recuperar os anos: QSqlError("42P01", "QPSQL: Unable to create query", "ERROR: relation \"sch_tg.va_turma\" does not exist\nLINE 1: SELECT ano FROM sch_tg.va_turma\n ^\n(42P01)")
Falha ao recuperar os anos: QSqlError("42P01", "QPSQL: Unable to create query", "ERROR: relation \"sch_tg.va_turma\" does not exist\nLINE 1: SELECT ano FROM sch_tg.va_turma\n ^\n(42P01)")
ASSERT: "platformWindow" in file qwindowscontext.cpp, line 1149
09:40:19: The program has unexpectedly finished.
09:40:19: The process was ended forcefully.