3
I am implementing an experimental registration program, and I made a case where, if a person types nothing and tries to register this empty data, it opens a QDialog
, receives the warning and does not complete the registration. Basically the code is:
Mainwindow class:
#include "dado.h"
#include "dialog.h"
class MainWindow : public QMainWindow
{
[...]
private slots:
void on_botaoInserir_clicked();
private:
Ui::MainWindow *ui;
Dado *dado;
Dialog dialog;
};
The class MainWindow
(program main window) has an object of type dialog
that is implemented by the class Dialog
:
Dialog class:
#include <QDialog>
namespace Ui {
class Dialog;
}
class Dialog : public QDialog
{
Q_OBJECT
public:
explicit Dialog(QWidget *parent = 0);
~Dialog();
void setAviso(QString);
QString getAviso();
private slots:
void on_dialogButton_clicked();
private:
Ui::Dialog *ui;
};
How to get the MainWindow
only become clickable after the dialog window is closed? Because even with the dialog window open I can still move and perform another registration in the main window.
Excerpt that opens the dialogue if the user does not inform the data and try to register (located in MainWindow
):
[...]
ui->statusBar->showMessage("Pessoa adicionada.", SB_MESS_TIME);
}
else{
dialog.setAviso("Digite um nome.");
dialog.setFocus();
dialog.show();
}
[...]
I hope someone says a way to "lock" the main window while the object dialog
above is running the function show()
.
I believe this occurs in the instantiation of
dialog
. Please post the code so we can help you :)– user2692
The instantiation is in the third code. It uses a dialog object created based on the first code.
– Rafael Bluhm