laurent
laurent

Reputation: 90853

Fully disable Qt main window including menu bar?

I need to temporarily disable the main window, including the menu bar. The main window can be disabled simply using setEnabled(false) however it seems that doesn't disable the menu bar, so the user can still click menu items (which in my case break the application).

Is there any way to completely disable all user interactions, including the menu bar?

Upvotes: 0

Views: 2613

Answers (2)

cassandrad
cassandrad

Reputation: 3536

You should set parent of the menu bar. It should be main window. If parent disabled, actions will be disabled too.

Upvotes: 1

Nejat
Nejat

Reputation: 32685

Calling setEnabled(false) in main window also disables menu bar. Any way you can also use setEnabled method of QMenuBar class :

ui->menuBar->setEnabled(false);

Upvotes: 2

Related Questions