Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Retina QPixmap

Retina QPixmap

Scheduled Pinned Locked Moved General and Desktop
4 Posts 1 Posters 3.7k Views
  • 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 Offline
    K Offline
    kegon
    wrote on last edited by
    #1

    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
    0
    • K Offline
      K Offline
      kegon
      wrote on last edited by
      #2

      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
      0
      • K Offline
        K Offline
        kegon
        wrote on last edited by
        #3

        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
        0
        • K Offline
          K Offline
          kegon
          wrote on last edited by
          #4

          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
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved