Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Retina QPixmap

    General and Desktop
    1
    4
    3433
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      kegon last edited by

      I am trying to support Retina displays for my applications via Qt 5.0.1 / MacOS X 10.8.3.

      Under Retina simulation, my application window and all widgets are drawn in High DPI but the pixmaps are pixellated and blocky.

      My interpretation of what I have read is that I can do this

      @
      QIcon about_icon(QPixmap(":/info.png"));
      about_icon.addPixmap(QPixmap(":/info@2x.png"));

      QToolButton about_button = new QToolButton;
      about_button->setIcon(about_icon);
      @

      I tried adding

      @qputenv("QT_HIGHDPI_AWARE", "1");@

      to my main widget constructor and also changing to

      @
      QIcon about_icon(QPixmap(":/info.png"));
      QPixmap about2x(":/info@2x.png");
      about2x.setDevicePixelRatio(2.0);
      about_icon.addPixmap(about2x);

      QToolButton about_button = new QToolButton;
      about_button->setIcon(about_icon);
      @

      but neither approach helps.

      My understanding was that a QPixmap loading a filename of the type "foobar@2x.ext" would automatically tag it as High DPI; but something is still missing here.

      1 Reply Last reply Reply Quote 0
      • K
        kegon last edited by

        Simulating Retina on my laptop was doing my head in, so I now use a mini DisplayPort-HDMI cable connected to a 1920x1080 external monitor.

        When I move windows to the second display, Qt does not promote them; only system window decorations get promoted to HighDPI.

        1 Reply Last reply Reply Quote 0
        • K
          kegon last edited by

          qApp->devicePixelRatio() reports a value of 2 under simulation.

          If I create a QIcon with a single 2x pixmap, with setDevicePixelRatio(2), I still get pixellated icons -

          @
          QIcon about_icon;
          QPixmap about2x(":/info@2x.png");
          about2x.setDevicePixelRatio(2);
          about_icon.addPixmap(about2x);
          @

          1 Reply Last reply Reply Quote 0
          • K
            kegon last edited by

            I found this document in source https://qt.gitorious.org/qt/qtbase/blobs/da6bdffdcdb57669af13cfd531151fe0abc05be3/src/gui/doc/src/highdpi.qdoc

            but I can't see where this comes from or what versions it affects.

            Trying export QT_EMULATED_HIGHDPI=1 has no effect.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post