Answer the question
In order to leave comments, you need to log in
Why is the window disappearing?
Hello! I create a dialog box on top of the standard MainWindow in the QT environment. I declare it Dialog dlg and call it dlg.show(), but it appears and disappears immediately, what could be the reason?
Answer the question
In order to leave comments, you need to log in
For dialogs, call not show() as you would for a regular widget, but exec():
dlg.exec().
With the fact that when you exit the scope of the dlg instance, the window is destroyed along with the instance. Create a dlg on the heap:
Dialog* dlg=new Dialog(...);
dlg->show();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question