Search code examples
pythonqtpyqtpyside

Optimising Python QT apps on retina displays


Qt interfaces currently look horrible on a retina display as they scale up.Its possible to use an Info.Plist for a complied application but does anyone have a solution for dynamic python such as interfaces created in PySide?


Solution

  • You didn't say what Qt version you're working with. Retina support is best in the latest release, Qt v5.1. but v5.0's is also pretty good. If you're still on Qt v4.8, you'll have to manually apply patches to enable high DPI.

    High DPI mode is controlled by the following keys in the Info.Plist file:

    <key>NSPrincipalClass</key>
    <string>NSApplication</string>
    <key>NSHighResolutionCapable</key>
    <string>True</string>
    

    Qt 5 uses the raster paint engine and implements high-dpi vector graphics by scaling the painter transform. If NSHighResolutionCapable is not set, the application will be rendered at the “normal” resolution which will simply be scaled up. This looks horrible on high resolution displays. On the other hand the high resolution mode is fully backwards compatible and is rendered nicely on lower resolution displays. I would leave it enabled all the time.

    Once high DPI is enabled you still have to make sure that all your raster content (image resources) has a high-enough resolution to be displayed nicely. See the QT Blog post Retina display support for Mac OS, iOS and X11 for the full details.