Customize QMenu display with QProxyStyle
John Sturtz
john at sturtz.org
Mon Jun 9 21:36:06 BST 2025
------ Original Message ------
>From "Charles" <peacech at gmail.com>
To "John Sturtz" <john at sturtz.org>
Cc pyqt at riverbankcomputing.com
Date 6/9/2025 12:20:29 PM
Subject Re: Re[2]: Customize QMenu display with QProxyStyle
>QProxyStyle automatically proxies to the used application style.
I wondered if that mightn't be the case. That's fortunate.
>If you want rounded corners you need to port the whole C code in the
>OS style plugin that draws the menu item.
>
>Alternatively, use the fusion style which should be OS independent.
>With fusion style, overriding drawItemText should work.
Actually, I didn't particularly want rounded corners, although I'm not
sure I care that much.
If I set fusion for the whole app [app.setStyle('Fusion')], I don't get
rounded corners by default. But if I apply the proxy style, then I do.
If I don't set fusion for the whole app, I get rounded corners either
way.
And here's another interesting factoid: It seems that just the act of
trying to create a proxy style based on the existing style causes a
crash. This statement:
self.style = Style(file_menu.style())
makes the app crash on exit, even if I never actually use the created
proxy style.
Anyway, thanks again for your help. All this gives me plenty to go
forward with.
/John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20250609/172a237f/attachment.htm>
More information about the PyQt
mailing list