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 Hide the Right Arrow in QMenu?
Qt 6.11 is out! See what's new in the release blog

How to Hide the Right Arrow in QMenu?

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 4.8k 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.
  • M Offline
    M Offline
    Macro
    wrote on last edited by
    #1

    Can anyone please suggest me a way for hiding the right arrows of the QMenu. I tried using the stylesheet, but it doesn't works.

    MenuRightArrow.qss

    @QMenu::right-arrow[hide="true"]
    {
    image: url(Resources/MenuRight.png); //am using an unavailable image so that it will return empty.
    }@

    And in cpp file, i have set the property for hiding the right arrows of the QMenu.

    @menuItems-->setProperty("hide", true);@

    In the stylesheet, if I remove the dynamic property "["hide", true]" then if i set a background color for the right arrows, then it works fine. but when am using the property ["hide", true], then the right arrow is not hiding. Please suggest.

    @QMenu::right-arrow
    {
    background-color: red;
    }@

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      this is not correct:
      @
      QMenu::right-arrow[hide="true"]
      {
      }
      @

      but this is:
      @
      QMenu[hide="true"]::right-arrow
      {
      }
      @

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Macro
        wrote on last edited by
        #3

        Thanks for your reply raven-worx..

        I tried as per your suggestion, but it doesn't work. :'(

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Macro
          wrote on last edited by
          #4

          I tried searching in google to find out a solution for hiding the right arrows of a QMenu, but unfortunately I couldn't get any positive results.

          Is it a BUG in Qt?

          Plesae post your suggestions..

          1 Reply Last reply
          0
          • raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #5

            another possibility would be to set a 1x1 px transparent png. Maybe Qt rejects a image it can't find? I don't know...

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Macro
              wrote on last edited by
              #6

              bq. Maybe Qt rejects a image it can’t find? I don’t know…

              No. Qt will not reject an image if it is unavailable. If the specified image is unavailable it will return as empty.

              1 Reply Last reply
              0
              • Navis-RavenN Offline
                Navis-RavenN Offline
                Navis-Raven
                wrote on last edited by
                #7

                I have the same problem, I've searched all google and I have no answer. So I added it as a suggestion in the Qt bug tracker

                aha_1980A 1 Reply Last reply
                0
                • Navis-RavenN Navis-Raven

                  I have the same problem, I've searched all google and I have no answer. So I added it as a suggestion in the Qt bug tracker

                  aha_1980A Offline
                  aha_1980A Offline
                  aha_1980
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Navis-Raven You could have provided a link to the bugreport here.

                  I'll do it for you this time: QTBUG-74501

                  Qt has to stay free or it will die.

                  1 Reply Last reply
                  4

                  • Login

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