Need to store a python reference to the menu on the action to avoid the menu being deleted in case it is not stored anywhere else

This commit is contained in:
Kovid Goyal 2021-11-21 21:40:32 +05:30
parent 7bfed9dcfa
commit f4ead1897e
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -34,7 +34,12 @@
# Restore ability to associate a menu with an action
QAction.setMenu = lambda self, menu: progress_indicator.set_menu_on_action(self, menu)
def set_menu(self, menu):
self.keep_menu_ref = menu
progress_indicator.set_menu_on_action(self, menu)
QAction.setMenu = set_menu
QAction.menu = lambda self: progress_indicator.menu_for_action(self)