QIcon Gnome Tray Icon Distortion
-
Hi,
I'm using Qt 6.5 and trying to add a QIcon to my Gnome desktop.
No matter what I do, I can't stop it from distorting the middle of the image. Here is the distortion I am talking about:The image above has been zoomed in to make the distortion clear.
That red icon should look like this:
The picture above is open in Firefox with a similar level of zoom.
Why is it adding knuckles to my finger (it is a pointing hand)?
The source of the image is a simple SVG file:
<?xml version="1.0" encoding="UTF-8"?> <svg width="22" height="22" version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg"> <g fill="#ff0000" fill-opacity=".99776" stroke="#ff0000" stroke-linecap="round" stroke-opacity=".98976" stroke-width="3.7843"> <path id="pointer" d="m2.3134 2.3134 17.294 17.294"/> <path id="thumb" d="m19.608 19.608v-14.109"/> <path id="middle" d="m11.416 19.608-5.9165-5.9165"/> <path id="pinky" d="m3.6788 19.608-1.3654-1.3654"/> </g> </svg>
I've tried the following to fix it:
- Many different width/height viewBox options made with Inkscape
- Shrinking the image in its container
- PNG versions at a few different sizes
- Adding multiple files into the QIcon
I should point out I'm using https://extensions.gnome.org/extension/2890/tray-icons-reloaded/ to show icons in Gnome.
Here is the QIcon code:
trayIconMenu = new QMenu(this); trayIconMenu->addAction(minimizeAction); trayIconMenu->addAction(maximizeAction); trayIconMenu->addAction(restoreAction); trayIconMenu->addSeparator(); trayIconMenu->addAction(quitAction); QIcon tekapointIcon(":/res/tekapoint-16.svg"); tekapointIcon.addFile(":/res/tekapoint-22.svg"); tekapointIcon.addFile(":/res/tekapoint-24.svg"); tekapointIcon.addFile(":/res/tekapoint-32.svg"); tekapointIcon.addFile(":/res/tekapoint-48.svg"); tekapointIcon.addFile(":/res/tekapoint-128.svg"); trayIcon = new QSystemTrayIcon(this); trayIcon->setContextMenu(trayIconMenu); trayIcon->setIcon(tekapointIcon); trayIcon->show();
Note the extra viewport size images here don't help. I've tried each on its own.
Any ideas are welcome.
It wasn't until writing this post that I realized that the issue may not be Qt, but the Gnome Extension "tray-icons-reloaded"!
For reference, I'm working on a new version of https://tekapoint.com/
-
Hi,
I'm using Qt 6.5 and trying to add a QIcon to my Gnome desktop.
No matter what I do, I can't stop it from distorting the middle of the image. Here is the distortion I am talking about:The image above has been zoomed in to make the distortion clear.
That red icon should look like this:
The picture above is open in Firefox with a similar level of zoom.
Why is it adding knuckles to my finger (it is a pointing hand)?
The source of the image is a simple SVG file:
<?xml version="1.0" encoding="UTF-8"?> <svg width="22" height="22" version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg"> <g fill="#ff0000" fill-opacity=".99776" stroke="#ff0000" stroke-linecap="round" stroke-opacity=".98976" stroke-width="3.7843"> <path id="pointer" d="m2.3134 2.3134 17.294 17.294"/> <path id="thumb" d="m19.608 19.608v-14.109"/> <path id="middle" d="m11.416 19.608-5.9165-5.9165"/> <path id="pinky" d="m3.6788 19.608-1.3654-1.3654"/> </g> </svg>
I've tried the following to fix it:
- Many different width/height viewBox options made with Inkscape
- Shrinking the image in its container
- PNG versions at a few different sizes
- Adding multiple files into the QIcon
I should point out I'm using https://extensions.gnome.org/extension/2890/tray-icons-reloaded/ to show icons in Gnome.
Here is the QIcon code:
trayIconMenu = new QMenu(this); trayIconMenu->addAction(minimizeAction); trayIconMenu->addAction(maximizeAction); trayIconMenu->addAction(restoreAction); trayIconMenu->addSeparator(); trayIconMenu->addAction(quitAction); QIcon tekapointIcon(":/res/tekapoint-16.svg"); tekapointIcon.addFile(":/res/tekapoint-22.svg"); tekapointIcon.addFile(":/res/tekapoint-24.svg"); tekapointIcon.addFile(":/res/tekapoint-32.svg"); tekapointIcon.addFile(":/res/tekapoint-48.svg"); tekapointIcon.addFile(":/res/tekapoint-128.svg"); trayIcon = new QSystemTrayIcon(this); trayIcon->setContextMenu(trayIconMenu); trayIcon->setIcon(tekapointIcon); trayIcon->show();
Note the extra viewport size images here don't help. I've tried each on its own.
Any ideas are welcome.
It wasn't until writing this post that I realized that the issue may not be Qt, but the Gnome Extension "tray-icons-reloaded"!
For reference, I'm working on a new version of https://tekapoint.com/
Well, there you go. Explaining an issue to somebody always helps.
By typing up this issue I realized it could be the Gnome extension.I tried a different tray icon extension:
https://extensions.gnome.org/extension/615/appindicator-support/
And the distortion is gone.
Problem fixed. Sorry for the noise.
I'll leave this here for anyone else who searches.
-
S SGaist has marked this topic as solved on