Skip to content

Commit

Permalink
Fixed High DPI Displays font and window scaling
Browse files Browse the repository at this point in the history
The QApplication app was being created after the two QApplication::setAttribute for scaling where being called - so they never where applied to the window!
  • Loading branch information
alanspencer committed Oct 17, 2018
1 parent 57213ee commit b6758fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ void logMessageOutput(QtMsgType type, const QMessageLogContext &context, const Q
*/
int main(int argc, char *argv[])
{
QApplication app( argc, argv );

// This has the app draw at HiDPI scaling on HiDPI displays, usually two pixels for every one logical pixel
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

Expand All @@ -106,8 +108,6 @@ int main(int argc, char *argv[])
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif

QApplication app( argc, argv );

// Install the message handler to log to file
qInstallMessageHandler(logMessageOutput);

Expand Down

0 comments on commit b6758fc

Please sign in to comment.