Qt5: How to hide or remove QMenu from QMenuBar?

I am using Qt5 on the Windows7 platform:
Qt Creator version: v3.3.2.
Qt version 5.5.1 and MinGW 32bit.

Currently, the menu bar has:

Configuration - Reports - Help

I was looking for SO and I found this as a possible answer: Failed to hide the QMenu object QMenu :: setVisible ()? but he didn 't work ...

So, I tried to remove the help menu using:

ui->menuHelp->setVisible(false);

and:

ui->menuHelp->menuAction()->setVisible(false);

Unfortunately, both could not hide / delete the menu Help...

Please, is there any other way to do this?

[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) // just testing...
       ui->menuHelp->menuAction()->setVisible(false);
}
+4
source share
1 answer

3 menuBar.
:

ui->menu3->menuAction()->setVisible(false);

, , - menu3. .

ui->menuHelp->setVisible(false); , menuBar. , menuBar, . . , - , .

+10

Source: https://habr.com/ru/post/1624563/


All Articles