Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to prevent the hide operation of a toolbar?

Tags:

In Qt, if I right-click on a toolbar the menu will be shown that allows me to hide the toolbar. I need to disable this functionality because I don't want the toolbar to possible to hide. Is there a way to do this?

like image 231
Sergey Skoblikov Avatar asked Mar 16 '09 15:03

Sergey Skoblikov


1 Answers

I was able to set the ContextMenuPolicy directly on the toolbar (not the main window), as long as I used either Qt::PreventContextMenu or Qt::ActionsContextMenu. Prevent eliminated the context menu and made right-click have no effect on the toolbar, while Actions made a nice context menu composed of the actions already in my toolbar. Qt::NoContextMenu didn't seem to have any effect.

toolbar->setContextMenuPolicy(Qt::PreventContextMenu);

like image 65
Nolan Amy Avatar answered Sep 20 '22 15:09

Nolan Amy