From bdfe1ea6a587220a93a843c7b629e810787d9f85 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 30 Jul 2016 11:51:35 +0200 Subject: gui/main: fix qt style palette Only changing style after QApplication's been defined sets the palette. --- gui/main.cpp | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'gui') 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 #include +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 -- cgit v1.2.3