How to Hide the Right Arrow in QMenu?



  • 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;
    }@


  • Moderators

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

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



  • Thanks for your reply raven-worx..

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



  • 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..


  • Moderators

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



  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.