I would like to use a QMenu as a permanent widget in the gui. (I like its appearance and layout, and the fact that as soon as I hover over it, the requisite menu pops up, no clicking needed. It would be a pain in the neck to try and emulate it with a custom widget.) I have tried adding it to a parent widget’s layout, but after the first time it is used, it disappears. How would I go about keeping it there?
Share
I can’t find any option in
QMenuthat would disable auto-hide, so simplest way would be a subclass that overrideshideEvent.hideEventis fired just beforehide()completes. That means you can’t intercept/ignorehide()but you can re-show it:Just make your top-level menu from
PermanentMenuand it should be fine.A simple example using it: