diff --git a/src/klayout_main/klayout_main/klayout.cc b/src/klayout_main/klayout_main/klayout.cc index 40cca527b..49ca8aa86 100644 --- a/src/klayout_main/klayout_main/klayout.cc +++ b/src/klayout_main/klayout_main/klayout.cc @@ -302,6 +302,7 @@ klayout_main_cont (int &argc, char **argv) if (non_ui_mode) { app.reset (new lay::NonGuiApplication (argc, argv)); } else { + lay::GuiApplication::initialize (); app.reset (new lay::GuiApplication (argc, argv)); lay::enable_signal_handler_gui (true); } diff --git a/src/lay/lay/layApplication.cc b/src/lay/lay/layApplication.cc index fe517860e..5aee10b73 100644 --- a/src/lay/lay/layApplication.cc +++ b/src/lay/lay/layApplication.cc @@ -1434,12 +1434,6 @@ GuiApplication::GuiApplication (int &argc, char **argv) setStyle (new lay::BackgroundAwareTreeStyle (0)); setWindowIcon (QIcon (QString::fromUtf8 (":/logo.png"))); -#if QT_VERSION >= 0x040500 - setAttribute (Qt::AA_DontShowIconsInMenus, false); -#endif -#if QT_VERSION >= 0x050000 - setAttribute (Qt::AA_UseHighDpiPixmaps, true); -#endif } GuiApplication::~GuiApplication () @@ -1453,6 +1447,20 @@ GuiApplication::~GuiApplication () shutdown (); } +void +GuiApplication::initialize () +{ +#if QT_VERSION >= 0x040500 + QCoreApplication::setAttribute (Qt::AA_DontShowIconsInMenus, false); +#endif +#if QT_VERSION >= 0x050000 + QCoreApplication::setAttribute (Qt::AA_UseHighDpiPixmaps, true); +#endif +#if QT_VERSION >= 0x050600 + QCoreApplication::setAttribute (Qt::AA_EnableHighDpiScaling, true); +#endif +} + bool GuiApplication::notify (QObject *receiver, QEvent *e) { diff --git a/src/lay/lay/layApplication.h b/src/lay/lay/layApplication.h index e5794cefd..6b42e1318 100644 --- a/src/lay/lay/layApplication.h +++ b/src/lay/lay/layApplication.h @@ -390,6 +390,13 @@ public: QApplication *qapp_gui () { return this; } + /** + * @brief Does some pre-initialization + * + * Must be called before the GuiApplication object is created + */ + static void initialize (); + /** * @brief Reimplementation of notify from QApplication */