style not drawing menu section/separator if 1st in menu

René J. V. Bertin rjvbertin at gmail.com
Tue Mar 21 22:14:57 UTC 2017


Christoph Feck wrote:

> On 21.03.2017 16:36, René J. V. Bertin wrote:
>> FWIW the same thing happens with both Breeze and Oxygen in their Qt4
>> versions.
> 
> Expected, since QMenu:addSection() is new in Qt 5.

True, but not the possibility to set a text hint on a separator. I should have 
mentioned that's what I tested.

> Anyway, I researched a bit, you want QStyle::SH_Menu_SupportsSections.

Thanks, we must have found that at about the same time. :)
It's exactly the kind of thing I expected but annoyingly it didn't occur to me 
to check the StyleHints for a relevant token.

What's also annoying is Qt's attitude towards the feature: just don't use it on 
platforms that don't support texted separators. Basically that's saying "don't 
use them at all if you consider running on Mac or MS Windows". With the 
StyleHint it becomes trivial to emulate named sections in QMenu::addSection() 
itself (for instance by putting the text in a disabled & centred action above 
the separator).

R




More information about the Plasma-devel mailing list