[SOLVED] Embedded QMainWindow-deriven widget in application
-
wrote on 25 May 2012, 15:03 last edited by
I would like to have a widget, deriven from QMainWindow in my application. So I can add toolbars, and menus. Or may be somehow add toolbars to my custom widget (derived from any possible class). Toolbars should behave like a mainwindows's toolbar.
-
wrote on 25 May 2012, 15:25 last edited by
This image may be more descriptive. See the widget on the right bottom:
-
wrote on 27 May 2012, 16:08 last edited by
Still have no idea about how to implement...
-
wrote on 27 May 2012, 16:33 last edited by
I see, you want to embedding a instance of QMainWindow into a normal QWidget. In other words, you don't want to show it as a seperated window.
So just
@
mw->setWindowFlags(mw->windowFlags() & ~Qt::Window);
@Or, You even do not need QMainWindow for such a simple widget contains QMenuBar.
As QMenuBar, QToolBar and QStatusBar are subclass of QWidget, you can put them to a normal QWidget, the same as you put a QPushButton onto it.
-
wrote on 27 May 2012, 19:38 last edited by
[quote author="1+1=2" date="1338136412"]
Or, You even do not need QMainWindow for such a simple widget contains QMenuBar.As QMenuBar, QToolBar and QStatusBar are subclass of QWidget, you can put them to a normal QWidget, the same as you put a QPushButton onto it.
[/quote]Yes, but toolbars won't move around and they will loss their dockablity. Also that small context menu that allows us to choose which toolbar should be show, is no more available.
First solution looks more convenient but have problems. Size grip is still there. And trying to adjust size of embedded MW will resize whole application :-/
-
wrote on 28 May 2012, 00:07 last edited by
I think that "Size grip " will disappear if you didn't create a QStatusBar.
-
wrote on 28 May 2012, 06:59 last edited by
Nicely works
You saved my day, again ;)
Thanks
1/7