[Interest] icons in menus

René J. V. Bertin rjvbertin at gmail.com
Mon Sep 14 13:21:10 CEST 2015


Rutledge Shawn wrote:


>> No.
>> 
>> Applications on OS X don't have icons in the menu - as per Apple HIG.

Yes, that's what should be the case.

>> Also refer to http://doc.qt.io/qt-5/qt.html#ApplicationAttribute-enum
>> 
>> (Not sure whether it is necessary to explicitly set
>> 
>> Qt::AA_DontShowIconsInMenus
>> 
>> /before/ instantiating QApplication or whether that's set by default on OS X)
> 
> It’s the default.  Qt uses native menus on OS X (rendering the menubar
> ourselves is not an option), and I don’t think they can display icons at all.

As a matter of fact they can, be it in "systray" menu items or in regular menu 
items. (You cannot render the menubar yourself, but items in menus in that bar 
are a different matter.)
There have always been Qt applications that displayed icons in menus despite the 
HIG, but I cannot recall noticing that the qttools applications did it too. 
Double-checking now it turns out that even the older Qt 4.7.3 and 5.4.0 
Assistant (etc) applications installed through the official binaries activate 
icons in menus, so what I'm seeing is not the result of some local patch I'm 
running.
Qt Creator is well-behaved though, using the same Qt libraries, possibly because 
it calls setIconVisibleInMenu(false) in 2 locations if 
Utils::HostOsInfo::isMacHost() .

And FWIW, I cannot find where AA_DontShowIconsInMenus is set in the default 
attributes on OS X (and other platforms where this would be required). That 
should be the initialisation of uint QCoreApplicationPrivate::attribs in 
qcoreapplication.cpp, no?

R.




More information about the Interest mailing list