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. QSystemTrayIcon is blurred if it's not square
Forum Updated to NodeBB v4.3 + New Features

QSystemTrayIcon is blurred if it's not square

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.7k Views 2 Watching
  • 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.
  • A Offline
    A Offline
    adutzu89
    wrote on last edited by
    #1

    I'm trying to make a system tray icon from text info.
    If I set the image size to 22x22 the text is ok, if I set it to 44x22(which is what I desire) the text goes blurry.
    I have tried changing the font size and devicePixelRatio but nothing solves, I also tried making it from 2 images of size 22x22(both scaled and unscaled with KeepAspectRation).

    This is the code:

    QImage image(44, 22, QImage::Format_ARGB32_Premultiplied);
    image.fill(QColor(0,0,0,0));
    QPainter painter(&image);
    painter.setPen(QColor(Qt::white));
    painter.drawText(QRect(22, 0, 22, 22), Qt::AlignRight, weather);
    

    I also tried changing the image format. Anyone knows what's the issue?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      The issue comes from your expectation, QSystemTrayIcon uses square icons, see here.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • A Offline
        A Offline
        adutzu89
        wrote on last edited by
        #3

        @SGaist said in QSystemTrayIcon is blurred if it's not square:

        Hi,

        The issue comes from your expectation, QSystemTrayIcon uses square icons, see here.

        Hi SGaist,

        Isn't there a way to make rectangular icons like I've seen on other applications, somehow?(which aren't written in Qt)

        VRoninV 1 Reply Last reply
        0
        • A adutzu89

          @SGaist said in QSystemTrayIcon is blurred if it's not square:

          Hi,

          The issue comes from your expectation, QSystemTrayIcon uses square icons, see here.

          Hi SGaist,

          Isn't there a way to make rectangular icons like I've seen on other applications, somehow?(which aren't written in Qt)

          VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          @adutzu89 said in QSystemTrayIcon is blurred if it's not square:

          Isn't there a way to make rectangular icons

          Windows (7) only supports square ones so I don't think it's possible to have cross platform support for such a feature

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          A 1 Reply Last reply
          2
          • VRoninV VRonin

            @adutzu89 said in QSystemTrayIcon is blurred if it's not square:

            Isn't there a way to make rectangular icons

            Windows (7) only supports square ones so I don't think it's possible to have cross platform support for such a feature

            A Offline
            A Offline
            adutzu89
            wrote on last edited by
            #5

            @VRonin said in QSystemTrayIcon is blurred if it's not square:

            @adutzu89 said in QSystemTrayIcon is blurred if it's not square:

            Isn't there a way to make rectangular icons

            Windows (7) only supports square ones so I don't think it's possible to have cross platform support for such a feature

            I see, thank you.

            1 Reply Last reply
            0

            • Login

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