diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-07-30 11:51:35 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-07-30 19:54:10 +0200 |
commit | bdfe1ea6a587220a93a843c7b629e810787d9f85 (patch) | |
tree | 6e5637281fb3cf395e7acf9c8f732891857360e0 | |
parent | 71df0384ab5d57d9d56a622ebb924b553e154e03 (diff) |
gui/main: fix qt style palette
Only changing style after QApplication's been defined sets the palette.
-rw-r--r-- | gui/main.cpp | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/gui/main.cpp b/gui/main.cpp index e254ceab..e708dc9d 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -19,6 +19,26 @@ using namespace options; #include <memory> #include <cstring> +void set_qt_style() +{ +#if defined(_WIN32) || defined(__APPLE__) + // qt5 designer-made controls look like shit on 'doze -sh 20140921 + // also our OSX look leaves a lot to be desired -sh 20150726 + { + const QStringList preferred { "fusion", "windowsvista", "macintosh" }; + for (const auto& style_name : preferred) + { + QStyle* s = QStyleFactory::create(style_name); + if (s) + { + QApplication::setStyle(s); + break; + } + } + } +#endif +} + #ifdef _WIN32 void add_win32_path() @@ -96,28 +116,12 @@ int main(int argc, char** argv) QCoreApplication::addLibraryPath("."); #endif -#if defined(_WIN32) || defined(__APPLE__) - // qt5 designer-made controls look like shit on 'doze -sh 20140921 - // also our OSX look leaves a lot to be desired -sh 20150726 - { - const QStringList preferred { "fusion", "windowsvista", "macintosh" }; - for (const auto& style_name : preferred) - { - QStyle* s = QStyleFactory::create(style_name); - if (s) - { - QApplication::setStyle(s); - break; - } - } - } -#endif - - QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_X11InitThreads, true); QApplication app(argc, argv); + set_qt_style(); + #ifdef _WIN32 add_win32_path(); #endif |