Enable Qt's high-DPI scaling introduced in Qt5.6
[quassel.git] / src / common / main.cpp
index 6cbe438..01d9d82 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2015 by the Quassel Project                        *
+ *   Copyright (C) 2005-2016 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -103,13 +103,6 @@ int main(int argc, char **argv)
 # endif
 #endif
 
-    // Migrate settings from KDE4 to KF5 if appropriate
-#ifdef HAVE_KF5
-    Kdelibs4ConfigMigrator migrator(QCoreApplication::applicationName());
-    migrator.setConfigFiles(QStringList() << "quasselrc" << "quassel.notifyrc");
-    migrator.migrate();
-#endif
-
     AbstractCliParser *cliParser;
 
 #ifdef HAVE_KDE4
@@ -184,13 +177,19 @@ int main(int argc, char **argv)
     }
 #endif
 
-#  if defined BUILD_CORE
+#if defined BUILD_CORE
     CoreApplication app(argc, argv);
-#  elif defined BUILD_QTUI
+#elif defined BUILD_QTUI
+# if QT_VERSION >= 0x050600
+    QtUiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+# endif
     QtUiApplication app(argc, argv);
-#  elif defined BUILD_MONO
+#elif defined BUILD_MONO
+# if QT_VERSION >= 0x050600
+    MonolithicApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+# endif
     MonolithicApplication app(argc, argv);
-#  endif
+#endif
 
 #ifndef HAVE_KDE4
     // the non-KDE version parses after app has been instantiated
@@ -200,6 +199,13 @@ int main(int argc, char **argv)
     }
 #endif
 
+// Migrate settings from KDE4 to KF5 if appropriate
+#ifdef HAVE_KF5
+    Kdelibs4ConfigMigrator migrator(QCoreApplication::applicationName());
+    migrator.setConfigFiles(QStringList() << "quasselrc" << "quassel.notifyrc");
+    migrator.migrate();
+#endif
+
 #ifdef HAVE_KF5
     // FIXME: This should be done after loading the translation catalogue, but still in main()
     AboutData aboutData;