[Qt-interest] How to hide a QPushButtons menu indicator
Oliver Demetz
forenbeitraege at oliverdemetz.de
Thu Jul 16 13:01:03 CEST 2009
Ender EREL schrieb:
> There is nothing to implement. Style sheet will not be able to find
> "none.jpg" therefore the menu indicator will not be drawn. You just have
> to set the style sheet for your button to the given style sheet like this:
>
> myPushButton->setStyleSheet("QPushButton::menu-indicator{ image:
> url(none.jpg); }");
>
Chandru and Ender, thanks for your replies, but actually there is a
problem with your solution:
My button's text is right-aligned. If I now specify an non-existing file
as menu-indicator-image, the margins of my button stay unaltered, and
thus the text of buttons with menu is aligned a few pixels more to the
left than the text of buttons without menu.
What solved my problem was using a completely transparent image of size
1px times 1px. The size of this invisible menu-indicator is recognized
by the lib and the right margin is adjusted accordingliy.
Thanks for your help!
Best regards,
Oliver
More information about the Qt-interest-old
mailing list