Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to style QMenu right-arrow on hover using Qt Style Sheets?
Forum Updated to NodeBB v4.3 + New Features

How to style QMenu right-arrow on hover using Qt Style Sheets?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 61 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Oliver2025
    wrote last edited by
    #1

    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!

    Pl45m4P 1 Reply Last reply
    0
    • O Oliver2025

      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!

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote last edited by Pl45m4
      #2

      @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


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      O 1 Reply Last reply
      1
      • Pl45m4P Pl45m4

        @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

        O Offline
        O Offline
        Oliver2025
        wrote last edited by
        #3

        @Pl45m4
        Thanks—I totally forgot I had posted this before! I tried

        QMenu::right-arrow:hover
        

        but unfortunately it's still not working.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved