Thanks to the comments by @musicamante, I realized that I had misunderstood how QMenu works in relation to QActions (which is also reflected in the OP code).
So, if I want to style the item that displays "Options", even if it is created via options_menu = CustomMenu("Options", self)
, I actually have to set the style in the QMenu that ends up containing this item - which is the menu = QMenu(self)
.
So, a quick hack of the OP code to demonstrate this is:
# ...
def contextMenuEvent(self, event):
menu = QMenu(self)
style = MenuProxyStyle() # added
style.setBaseStyle(menu.style()) # added
menu.setStyle(style) # added
# ...
With this, the application renders the "Options" menu as disabled, however reaction to mouse move events is still active, so the submenu popup opens as usual:
... which is basically what I was looking for in OP.
Except, now all items in the main context menu = QMenu(self)
appear disabled, whereas I wanted to select only certain items in the menu
to appear disabled - so now will have to figure that out ...