is it possible to close the Main application window in qt without closing the second window?
is it possible to close the Main application window in qt without closing the second window?
Can you make second window also QMainWindow?
When you know how to do it then you may do it wrong.
When you don't know how to do it then it is not that you may do it wrong but you may not do it right.
Yes, it doesn't matter. One way is to hide the first window, which doesn't seem quite wise to do that. I think whatever window, dialog ... we create n call from the first window, it automatically become its child. So, that way if I close the first, the second one gets closed as well!
separate 'windows' do not have parents so it cannot be a child of mainwindow.
show code example.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
Not if you don't give the second widget a parent when you create it on the heap. The application will not close until the last top level window, i.e. parentless widget, is closed.
by the way can someone tell me what "Add to this user's reputation" really does?
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
That does not answer my question since just because you can do something doesn't mean it makes sense. Moreover, the main reason for my comment was the very fact that two instances of MainWindow was suggested. For you to ignore that and relegate the comparison to two widgets also does not answer my question.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
I fail to see how an application with two top-level windows, which can be any widget not just QMainWindow derivatives, is in any way non-sensical. Atypical for simple applications maybe, but not non-sensical. Picture a Qt browser application that opens and displays web pages. Besides the usual navigation menus the application window has a menu with a File > New Window option that opens a second independent window: same QApplication/process, multiple "main" windows, and the application will not close until all "main" windows are closed. This should sound familiar, most web browsers do exactly this.
Bookmarks