c++ - Qt5: How to hide or remove a QMenu from the QMenuBar? -


i using qt5 on windows7 platform:
qt creator version is: v3.3.2.
qt version 5.5.1 , mingw 32bit.

currently, in menu bar have:

configuration - reports - help

i searched , found possible answer: not possible hide qmenu object qmenu::setvisible()?, it didn't work...

so, trying remove menu using:

ui->menuhelp->setvisible(false); 

and:

ui->menuhelp->menuaction()->setvisible(false); 

unfortunatelly, both failed hide/remove help menu...

please, there other way it?

[code]:

mainwindow::mainwindow(qwidget * parent) :     qmainwindow(parent),     ui(new ui::mainwindow) {     ui->setupui(this);     this->setwindowflags(this->windowflags() & ~qt::windowmaximizebuttonhint);     if(!server.listen(qhostaddress("192.168.1.2"), 8001))         return;     if(true) // testing...        ui->menuhelp->menuaction()->setvisible(false); } 

just test, i've added 3 menus menubar.
tried this:

ui->menu3->menuaction()->setvisible(false); 

and worked expected - hides menu3. problem somewhere else.

the code ui->menuhelp->setvisible(false); hides menu, not action on menubar. example when click on action on menubar menu becomes visible. can hide line of code. when call directly constructor menu still invisible, code nothing.


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -