I am new to Qt (use Objective-C mostly) so I am stuck with probably noob issue. From the QDialog
window I try to open QMainWindow
like this:
Your window is a local variable it is destroyed at the end of the function and hence the destructor closes it.
What you could do is create the SQLWindow
on the heap with new SQLWindow
and e.g. use the Qt::WA_DeleteOnClose
attribute as shown here.
Alternatively, a better design might be to create both the dialog and the window as local variables of the main
function and let the main function pass the path from the dialog to the SQLWindow
, then you need no new
.