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();
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!
which platform are you using? And which Qt version?
To add to @aha_1980, QMainWindow already provides a menu bar when calling the menuBar function.
Now I found what I was searching for.
@aha_1980 Your way works!
Thank you so much!
The platform is Ubuntu 17.04 and QT is of 5.7. Looks the default style of Ubuntu is like this.
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.
@SGaist, you are right.
but at least Qt's Ubuntu/Unity integration has some bugs, so that QtCreator uses the non-native menu nowadays.