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

Button's icon blurry because of non-integer position

    XMLWordPrintable

Details

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

        Issue Links

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

          Activity

            People

              mitch_curtis Mitch Curtis
              laurentgom Laurent
              Votes:
              5 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes