[Interest] adapting a QMenu's width in a QStyle?
Sergio Martins
iamsergio at gmail.com
Tue Jun 7 21:25:45 CEST 2016
On Tuesday, 7 June 2016 19:27:18 WEST René J.V. Bertin wrote:
> Hi,
>
> I'm modifying a QStyle so that it uses the Unicode "check mark" glyph for
> checked menu items, because that I think should give a nice visual unity
> between the item text and the mark, both in style and in size (= when users
> select a really large font).
>
> The problem is that when I make horizontal space for the tick at large font
> sizes (say 32pt), the menu becomes too narrow. From what I understand,
> QStyle::drawPrimitive is called with PE_PanelMenu when the (popup) menu
> backdrop is to be drawn.
>
> What I'm not getting around is the fact that there appears to be some
> higher-priority clipping that prevents me from extending the right border.
> This also applies to the item text itself; it is clipped even if I give it
> an amply wide bounding rectangle.
How are you setting this bounding rectangle ?
Have you tried reimplementing QStyle::sizeFromContents() and handling
QStyle::CT_Menu ?
Regards,
Sérgio Martins
More information about the Interest
mailing list