Getting a bit complex with the timers there and which pop-ups need to stay open. But it seems to be working reliably now.
Contributes to issue CURA-8640.
The sub-menus were giving segfaults for some reason. We couldn't figure out how to circumvent that. So now we're at a last resort: Implement the whole thing ourselves, but with Popup instead of Menu.
Contributes to issue CURA-8640.