PDA

View Full Version : QMainWindow child of a QDialog



brevleq
15th January 2008, 23:44
I'm trying put a QMainWindow as a child of a QDialog!

My application have a QMainWindow, but I need a print view, and just with QMainWindow I can create a QToolBar with Qt Designer.
I created a var of my new QMainWindow type and putted his method show(), but this new QMainWindow isn't showed!!

How can I put this new QMainWindow inside my application??

:confused:

marcel
15th January 2008, 23:57
I created a var of my new QMainWindow type and putted his method show(), but this new QMainWindow isn't showed!!

If you created that var on the stack, in some function, it won't work, because the object will get destroyed as soon as the function exits.
Create the window instance on the heap(with new), and don't forget to delete it when you finish using it/or set the delete on close flag.

mchara
16th January 2008, 08:16
Hi,
i have mainWindow in dialog too, but for different reasons - i needed tab docking widgets with parts of a wizard that could be rearranged.

I found issue that when widgets are docked with vertical nesting(initially they are tabbed & only bottom dock area is available) central widget expands to large size(larger that maximum size) even if it have maximum policies.
Does anyone knows how to prevent central widget from resizing?