Pergunta

In my QMenuBar, I have several menus.

One of those menus has a QWidgetAction in it.

It shows up fine, but the problem is that once the user completes his input, I want the menu to disappear (as is the normal behavior for a classical QAction).

However, I am not sure on how to do that. In my QWidgetAction, there is a button the user presses when he is done; I can therefore bind to this button's clicked() signal.

In the slot, I tried to setFocus() an element outside the menu but the menu still doesn't disappear.

How to tell the menu to close itself when my users finish interacting with the QWidgetAction?

Thanks

Foi útil?

Solução

QMenu inherits QWidget, so calling yourMenu->hide() should do the work.

Hope this helps.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top