[SOLVED] Adding a Dynamic "qMenu" and "qMenuBar" to a QWindow object...
-
Hello,
I have a QWindow which works well for the OpenGL program I am using. It is declared like so:
@class QTApp : public QWindow, protected QOpenGLFunctions {
// Stuff
};@
Trouble is now I need to add a qMenu + qMenuBar to this QWindow. I will also need to hide the menu + menubar objects I add when I go full screen.
Since for qMenu, qMenuBar, and other items you need a parent of some qtWidgets type do I just inherit from another class? And if so can I still have OpenGL?
Thank you for your time.
-
QWindow does not support QMenu. You can implement it yourself.
Another option is to use QMainWindow with a "window container":http://qt-project.org/doc/qt-5/qwidget.html#createWindowContainer as it's central widget.
Take a look on Qt5.3.1/Examples/Qt-5.3/widgets/windowcontainer -
Thanks; I am looking at this now.
Perhaps the info is at the link but when you have a QMainWindow is it possible to make the widget INSIDE the QMainWindow full screen?
That way a person can toggle the widget itself full screen on/off?
Thanks for all of your time.
-
[quote author="tmason101" date="1410820988"]
Perhaps the info is at the link but when you have a QMainWindow is it possible to make the widget INSIDE the QMainWindow full screen?That way a person can toggle the widget itself full screen on/off?[/quote]
When you change QMainWindow state to a full screen you will need to hide a menu bar, a status bar and a tool bar if you have them.
When all of that bars are hidden only central widget is visible and it will occupy a whole screen. -
[quote author="andreyc" date="1410820812"]QWindow does not support QMenu. You can implement it yourself.
Another option is to use QMainWindow with a "window container":http://qt-project.org/doc/qt-5/qwidget.html#createWindowContainer as it's central widget.
Take a look on Qt5.3.1/Examples/Qt-5.3/widgets/windowcontainer
[/quote]Thanks, I tried this and it works great. Exactly what I needed.
-
[quote author="andreyc" date="1410821959"][quote author="tmason101" date="1410820988"]
Perhaps the info is at the link but when you have a QMainWindow is it possible to make the widget INSIDE the QMainWindow full screen?That way a person can toggle the widget itself full screen on/off?[/quote]
When you change QMainWindow state to a full screen you will need to hide a menu bar, a status bar and a tool bar if you have them.
When all of that bars are hidden only central widget is visible and it will occupy a whole screen.[/quote]
Thanks, will give this a go...