Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retina support in Qt5 on OS X

Tags:

c++

macos

qt

retina

I'm writing a C++ graphical application using Qt 5.5.0 on OS X El Capitan on a Retina MacBook Pro. Text is pixelated throughout the application so I suspect that high DPI mode is not used. My Info.plist contains the following definition:

<key>NSHighResolutionCapable</key>
    <true/>

How do I enable high resolution mode (especially for text rendering) in a Qt application on OS X?

like image 772
SurvivalMachine Avatar asked Dec 25 '15 18:12

SurvivalMachine


Video Answer


1 Answers

You also need to call QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps) just after creating QApplication object to be able to use High DPI pixmaps. Read more here: http://doc.qt.io/qt-5/qpixmap.html#devicePixelRatio

like image 154
Sergei Kulik Avatar answered Oct 03 '22 12:10

Sergei Kulik