Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create monochromatic tray icon for OS X using QSystemTrayIcon

OS X asks apps to use a 19x19px monochomatic PDF as a tray icon in order to adapt a system default color based on the user's theme.

Use a template image to represent a menu bar extra. In General system preferences, users can change the menu bar (and Dock) to a dark appearance. [...]

Can that be done using QSystemTrayIcon?

As far as I can see the underlying QIcon class does not support PDF.


At the moment I am using a black SVG, which is displayed in pure black, causing a very unnatural appearance.

Default theme:

SVG on default theme

Dark theme:

SVG on dark theme

like image 704
Simon Warta Avatar asked Aug 05 '15 16:08

Simon Warta


2 Answers

Its known issue of QT which going to be fixed in version 5.6

like image 103
toohtik Avatar answered Oct 17 '22 09:10

toohtik


This has been fixed in Qt 5.6. Just remember to set the isMask attribute on the QIcon like this: myQIcon.setIsMask(true) and then mySysTray.setIcon(myQIcon)

like image 35
Giacomo Lacava Avatar answered Oct 17 '22 10:10

Giacomo Lacava