MainWindow doesnt show MenuBar
-
@medyakovvit Already tried this, and many of other combination "removing-adding". No one helps
-
@Vadik
So you've tried this?QMenuBar *mb = menuBar(); mb->addMenu(file); this->setMenuBar(mb);
Also see https://stackoverflow.com/questions/41367027/qt-add-menubar-menus-and-sub-menus-to-qmainwindow
@JNBarchan said in MainWindow doesnt show MenuBar:
QMenuBar *mb = menuBar();
mb->addMenu(file);
this->setMenuBar(mb);yes, have tried, and the same code is working on other machines.
-
@JNBarchan said in MainWindow doesnt show MenuBar:
QMenuBar *mb = menuBar();
mb->addMenu(file);
this->setMenuBar(mb);yes, have tried, and the same code is working on other machines.
-
@Vadik
Oh, this is the first time you're saying the code works on some machines and not others? -
@Vadik
So I would look at exactly what version of Qt libraries is being used on your machine versus other machines? Maybe they have a later version than your 5.5, and it will work then? -
Hi,
Aren't you on Ubuntu ? If so, isn't your menu bar shown at the top of the screen macOS like ?
-
Hi,
Aren't you on Ubuntu ? If so, isn't your menu bar shown at the top of the screen macOS like ?
-
Hi,
Aren't you on Ubuntu ? If so, isn't your menu bar shown at the top of the screen macOS like ?
-
@Vadik YEEEEAH, solved, after some investigations and reinstalling of all components it turned out. Need to change in 'System Settings -> Appearance -> Behavior' parameter for 'Show the menus for a window' from the "In the menu bar" to "In the window's title bar". Thanks to everyone who tried to help.
-
@medyakovvit
Won't he needsetMenuBar(sb)
for his main window too?@JNBarchan Question is solved, but as you asked.
I don't think it's needed as he gets pointer to menu bar with:QMenuBar *mb = menuBar();
and this function returns the menu bar that already set.
-
@JNBarchan Question is solved, but as you asked.
I don't think it's needed as he gets pointer to menu bar with:QMenuBar *mb = menuBar();
and this function returns the menu bar that already set.
@medyakovvit
Yeah, I kinda mis-read (C++ not being my language) it as having been:QMenuBar *mb = new QMenuBar();
thinking he was creating his own new one which would need setting. Using the existing menubar and changing its content is of course preferable.