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. Basic.png
          11 kB
          Pierre-Yves Siret
        2. blurry_icon.zip
          2 kB
          Pierre-Yves Siret
        3. Fusion.png
          9 kB
          Pierre-Yves Siret
        4. Material.png
          13 kB
          Pierre-Yves Siret
        5. screenshot-zoomed.png
          21 kB
          Pierre-Yves Siret
        6. Universal.png
          6 kB
          Pierre-Yves Siret

        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