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

QML Text does not support devicePixelRatio for images

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.8.0
    • None
    • Any OS

    Description

          Text {
              anchors.centerIn: parent
      
              textFormat: Text.StyledText
              text: "My icon <img width=\"32\" height=\"32\" src=\"qrc:/my_icon.svg\">"
          }
      

      When devicePixelRatio==1 the image looks good, but when devicePixelRatio>1 then it looks fuzzy.
      I have tried to use custom QQuickImageProvider but it doesn't help because requestedSize is always 32x32 even when devicePixelRatio is bigger than 1.

      So, it is definitely a problem in QML Text implementation, because this code requests size 64x64 when devicePixelRatio==2 as expected.

          Image {
              source: "qrc:/my_icon.svg"
              sourceSize {
                  width: 32
                  height: 32
              }
          }
      

      P.S. In order to change devicePixelRatio I've used QT_SCALE_FACTOR environment variable.

      Attachments

        Issue Links

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

          Activity

            People

              esabraha Eskil Abrahamsen Blomfeldt
              kbukaev Kirill Bukaev
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes