How to Hide Right Arrow in QMenu in Qt?

2.3k views Asked by At

Can anyone please tell me how to hide the right arrow for the QMenu items. I tried using the stylesheet. But it didn't works.. Please Help.

MyStylesheet.qss

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

and in code i have set the property as,

menuItem->setProperty("hide", true);

but in the stylesheet(shown below) if i remove the dynamic property, then it is working fine. the background color of the right arrow changes to red.

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

There are 1 answers

0
Nils On

You can use the menu-indicator property in the stylesheet of the item.

Here with a QPushButton:

QPushButton::menu-indicator{ width:0px; };