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

Blurry images in HighDPI mode in Text Controls

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12.1
    • None
    • All

    Description

      Blurry images in HighDPI mode in Text Controls

      When set html with images to Text control images are blurry. Example:

      In main enable HighDPI support:

      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      
      int main(int argc, char *argv[])
      {
          QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
          QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
      
          QGuiApplication app(argc, argv);
      
          QQmlApplicationEngine engine;
          engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
          if (engine.rootObjects().isEmpty())
              return -1;
      
          return app.exec();
      }
      

      In QML file I insert image from base64 string. But if I use SVG or PNG image from resource situation is same.

      Text {
              id: element
              x: 53
              y: 164
              width: 218
              height: 121
              text: '<b>' + 'aaa' + '</b>' + '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAvFSURBVHhe7ZxpruTIDQbnIr7/CXwlX6Odwwo1JNaqPZcIBGCgnyqTSX78Of7nj5zMPzvgCDkNW3wYZPYquFX2YR+3QAYrg+JkDXbtV0jZev77v/9sliPWQ9HyDTv1CdL0Gym7p8qVv8Fj5BV2J0NqPpLiWIkU9xEeKRN2BAjIe1LaKpei38Ozh2f0RhCHN6RUNSqPeQONGJVx38/8n0jp6Uwe+Qr6MhjDPZtpvyJlpWN58Cto0zCM8mDG+4oUjqGkBa+gcb3T/zuZ5xMpCoNLU56gif3S8wuZ4ZI0eE3SpiU0tEf6fBtzW5ImrR+kZUtobl/09ipmtSRNV3+U9i2h0b3Qz3uYz5I0Ud0grVxC09unh5cwkyVpirpT2rqEAbRM829gFDPS5PRAafEMxtAsDT+ACcxI09KT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6UnS7hmMpEEaLv0BE5iRpqXHSpdnMIk2aX4BCsxhSRqb7pS2LmEALdPDGx4wkyVpirpBWrmEprdPPy95wHyWpInqj9K+JTS6F3p7zwNmtSRNVz9Iy5bQ3L7o81UPmNuSNGlN0qYlNLRHen7bA2b4RBr84NKUJ2hiv/T/wgfM8xUpCkNJC15B43pnlHf+hfE+kZLRvTz7Cdo0DMM9+AHTfkUKSmfyyFfQmsEY9Nl/YfhvSOlpVB7zBhoxKqO//y/E4T0pVZVL0e/h2cNjIzIE5CMpbZVIcR/hkTJhRz5Ban4gZfECufgHeIy8wu78CmlaTwruWjllJRQt37BTWyBllUFxsga7dgxk8EK4WPZhH0+HwG6FU+QM/vz5PxBCPdjmtFhFAAAAAElFTkSuQmCC" width="64" height="64">'
              font.pixelSize: 12
          }
      

      I insert 256x256 image with size 64x64.

      On screen I see this picture:

      Image size is 128x128 pixels. It is true, because I have device pixel ratio = 2 and 64 * 2 = 128. But source rendered image is 64x64 pixels. I think that engine not use device pixel ratio information and generate 64x64 pixels pixmap.

      It is bug or may be I can solve this? 

      Source image in attachment.

      Attachments

        1. test.png
          test.png
          3 kB
        2. test2222.png
          test2222.png
          9 kB

        Issue Links

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              keshav Konstantin Semenov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: