Any QWidget can be shown as a window. QMainWindow is not mandatory at all. It just provides support for such things as menubar, toolbars, dock widgets etc. The problem must lie somewhere in your code, so could you show us the relevant parts?
Any QWidget can be shown as a window. QMainWindow is not mandatory at all. It just provides support for such things as menubar, toolbars, dock widgets etc. The problem must lie somewhere in your code, so could you show us the relevant parts?
J-P Nurmi
Thanks. It turns out that if I don't specify the main dialog as the parent (use NULL instead for the parent widget), it does show up. the downside is that I don't get any control over the window (it is not recognizing mouse events).
I've done a custom work on this dialog so that must be the cause of the parenting issue. If I can manage to make a small working example, I'll post it.
another note in case anyone else runs into this.
My other problem was that I had set my main dialog to be modal. I thought that setting any other dialogs to non-modal would co-exist with that. It didn't. The answer is to make the main dialog non-modal (which it is by default) and any dialog that I want to be modal, to specifically set it modal through setModal(true).
Actually it's best to simply call exec() on dialogs you want to be modal instead of calling show(). Remember that modality is a relation term meaning that a window is modal relative to another window - it means the other window won't accept events as long as the modal dialog is open. This of course propagates, so if all your windows are modal to the ones that called them, only the last created window will accept input events. When you close it then its parent will accept input events, then its parent, etc.
Bookmarks