How to style QMenu right-arrow on hover using Qt Style Sheets?
-
I'm trying to customize the right-arrow icon in a QMenu when hovering over a menu item that has a submenu. I used the following style sheet:
QMenu::right-arrow { image: url(:/icons/menuRight.png); } QMenu::right-arrow:selected { image: url(:/icons/menuRight2.png); }
The default arrow icon (menuRight.png) displays correctly, but the selected state doesn't seem to apply when hovering over the menu item. The hover image (menuRight2.png) never shows up.
Is there a reliable way to change the right-arrow icon on hover? Or do I need to use a custom widget to achieve this?
Any help or workaround would be appreciated! -
I'm trying to customize the right-arrow icon in a QMenu when hovering over a menu item that has a submenu. I used the following style sheet:
QMenu::right-arrow { image: url(:/icons/menuRight.png); } QMenu::right-arrow:selected { image: url(:/icons/menuRight2.png); }
The default arrow icon (menuRight.png) displays correctly, but the selected state doesn't seem to apply when hovering over the menu item. The hover image (menuRight2.png) never shows up.
Is there a reliable way to change the right-arrow icon on hover? Or do I need to use a custom widget to achieve this?
Any help or workaround would be appreciated!@Oliver2025 said in How to style QMenu right-arrow on hover using Qt Style Sheets?:
when hovering over a menu item that has a submenu
"Selected" ≠ "hover"
Also, I'm not sure whether the
:hover
attribute works in this case or not.
BTW: "select" is what you do with e.g. list items in some view.Edit:
@SGaist has given you a similar answer to your last topic here -
@Oliver2025 said in How to style QMenu right-arrow on hover using Qt Style Sheets?:
when hovering over a menu item that has a submenu
"Selected" ≠ "hover"
Also, I'm not sure whether the
:hover
attribute works in this case or not.
BTW: "select" is what you do with e.g. list items in some view.Edit:
@SGaist has given you a similar answer to your last topic here@Pl45m4
Thanks—I totally forgot I had posted this before! I triedQMenu::right-arrow:hover
but unfortunately it's still not working.