문제

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

도움이 되었습니까?

해결책

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

Hope this helps.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top