PDA

View Full Version : Icon in a QMenu doesn't show up on Linux



agarny
2nd February 2011, 14:04
It would seem that menus on Linux don't display icons by default, if not at all. For one, and as mentioned here (http://www.qtcentre.org/threads/26679-Why-QAction-inside-Qmenu-doesn-t-display-Icon), there is the iconVisibleInMenu property for QAction which is, now, set to true by default. However, on Linux, it still doesn't work, unless you 'manually' set the property to false and then back to true (i.e. unlike in the default case, your .ui file will now include the fact that the property is set to true). So, that was one issue that I came across quite some time ago, but another which I hadn't noticed until yesterday is the icon associated to a QMenu. As mentioned here (http://bugreports.qt.nokia.com/browse/QTBUG-9040), the icon shows on Windows, but not on Linux. So, I was wondering whether someone had found a way around this problem, or do I have to wait for this bug to be fixed by the Qt guys?

rain87
2nd February 2011, 14:31
i guess you are using gnome (ubuntu)? menu icons are off, by default. here (http://www.howtogeek.com/howto/21149/how-to-enable-icons-on-the-ubuntu-system-menu-minor-annoyances/) are some explanations, maybe your problem is not binded with Qt :)

agarny
2nd February 2011, 14:45
Brilliant, thanks a lot for this link. I was definitely not aware of that 'feature' on Ubuntu (which I indeed use, not because I like it but nevermind! :)). Anyway, I have entered:


$ gconftool-2 --type Boolean --set /desktop/gnome/interface/menus_have_icons Trueand everything is now fine. Woo hoo! :)

rain87
2nd February 2011, 15:52
yes, pretty strange feature :) i don't understand, why is it turned on by default

agarny
2nd February 2011, 15:58
yes, pretty strange feature :) i don't understand, why is it turned on by defaultI guess you meant off... :) Whatever the case, thanks for your help on this matter, much appreciated!