Adding support for retina displays (HiDPI) to an existing Qt4 application
Asked Answered
I

0

8

What do I need to do to upgrade an existing Qt4 application to work with retina displays on OS X?

The Qt blog says that Qt 4.8 "has good support, and backports of some of the Qt 5 patches are available":

https://www.qt.io/blog/2013/04/25/retina-display-support-for-mac-os-ios-and-x11

I've added the following to Info.plist which seems to work. The text and buttons are no longer pixelated.

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

What I'm struggling with is getting the icons/pixmaps to render nicely. I've created the UI using Qt Designer. I don't see how to get the application to recognise the @2x icons.

The application I want to upgrade is written in C++ (https://github.com/qgis/QGIS), but I've also been testing with Python (PyQt4). The QPixamp instance doesn't seem to have a setDevicePixelRatio method.

I'm running OS X (10.9.4), with Qt 4.8 installed via Homebrew.

Irizarry answered 25/8, 2014 at 20:54 Comment(1)
Possible duplicate of How do I enable HiDPI (Retina) support in a Qt4 OpenGL application?Breastplate

© 2022 - 2024 — McMap. All rights reserved.