How to make the title visible for QMainWindow
-
I find that if menu is created on a QMainWindow, then its title text will be covered by the menus.
I create menu bar like this:
QMenuBar *menuBar = new QMenuBar();
this->setMenuBar(menuBar);
menuBar->addMenu("blabla");
...
Then the created window is like this
|x-o menu1 menu2 menu3|
| this is tool bar________|
|__________________|But what I want is like this:
|x-o window title |
|menu1 menu2 menu3 |
|this is tool bar________|
|__________________|How to make the title visible given there are menus?
Thanks in advance! -
I find that if menu is created on a QMainWindow, then its title text will be covered by the menus.
I create menu bar like this:
QMenuBar *menuBar = new QMenuBar();
this->setMenuBar(menuBar);
menuBar->addMenu("blabla");
...
Then the created window is like this
|x-o menu1 menu2 menu3|
| this is tool bar________|
|__________________|But what I want is like this:
|x-o window title |
|menu1 menu2 menu3 |
|this is tool bar________|
|__________________|How to make the title visible given there are menus?
Thanks in advance! -
I find that if menu is created on a QMainWindow, then its title text will be covered by the menus.
I create menu bar like this:
QMenuBar *menuBar = new QMenuBar();
this->setMenuBar(menuBar);
menuBar->addMenu("blabla");
...
Then the created window is like this
|x-o menu1 menu2 menu3|
| this is tool bar________|
|__________________|But what I want is like this:
|x-o window title |
|menu1 menu2 menu3 |
|this is tool bar________|
|__________________|How to make the title visible given there are menus?
Thanks in advance!Hi @lingan,
Now I found what I was searching for.
It's:
menuBar->setNativeMenuBar(false);
Docu: http://doc.qt.io/qt-5/qmenubar.html#nativeMenuBar-prop
-
Hi @lingan,
Now I found what I was searching for.
It's:
menuBar->setNativeMenuBar(false);
Docu: http://doc.qt.io/qt-5/qmenubar.html#nativeMenuBar-prop
-
Just be aware that you are "breaking integration" with the desktop environment you use which might not be appreciated by your application users.
You would get the same behaviour on e.g. macOS where the main menu is at the top of the screen and not on your application windows.
-
Just be aware that you are "breaking integration" with the desktop environment you use which might not be appreciated by your application users.
You would get the same behaviour on e.g. macOS where the main menu is at the top of the screen and not on your application windows.