Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-80344

Button's icon blurry because of non-integer position

    XMLWordPrintable

Details

    • a7d2d1b8d (dev), 9f706407b (6.8)

    Description

      When using the Button control (from QtQuick Controls 2), I noticed that sometimes the icon would appear blurry and slightly cropped.

      After some debugging, I found that it may be caused by non-integer coordinates of the internal image, due to centering with the label.

      In qquickiconlabel.cpp, line 288 (QQuickIconLabelPrivate::layout()) :

      QRectF iconRect = alignedRect(mirrored, Qt::AlignHCenter | Qt::AlignTop, iconSize, combinedRect);
      image->setSize(iconRect.size());
      image->setPosition(iconRect.topLeft());
      

      ... when iconRect.left() is an integer, the icon is sharp and not cropped. When iconRect.left() is a decimal number, the icon appears blurry.

      Attachments

        1. blurry_icon.zip
          2 kB
        2. Basic.png
          Basic.png
          11 kB
        3. Fusion.png
          Fusion.png
          9 kB
        4. Material.png
          Material.png
          13 kB
        5. Universal.png
          Universal.png
          6 kB
        6. screenshot-zoomed.png
          screenshot-zoomed.png
          21 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              vgt Eirik Aavitsland
              laurentgom Laurent
              Votes:
              5 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes