Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QIcon Gnome Tray Icon Distortion
Forum Updated to NodeBB v4.3 + New Features

QIcon Gnome Tray Icon Distortion

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 245 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Grant Carthew
    wrote on last edited by
    #1

    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:

    Screenshot from 2023-12-09 12-40-07.png

    The image above has been zoomed in to make the distortion clear.

    That red icon should look like this:

    Screenshot from 2023-12-09 12-46-08.png

    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/

    G 1 Reply Last reply
    0
    • G Grant Carthew

      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:

      Screenshot from 2023-12-09 12-40-07.png

      The image above has been zoomed in to make the distortion clear.

      That red icon should look like this:

      Screenshot from 2023-12-09 12-46-08.png

      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/

      G Offline
      G Offline
      Grant Carthew
      wrote on last edited by
      #2

      @Grant-Carthew

      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.

      1 Reply Last reply
      1
      • SGaistS SGaist has marked this topic as solved on

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved