From 5a334175a8b5047cf56552c0bf5a54c3e3e14893 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Mon, 18 Sep 2023 08:38:35 +0300 Subject: [PATCH] Use Fusion style on Windows 10+ PR #19051. --- src/app/main.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index fcd33212a..6cb174c6c 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -1,6 +1,6 @@ /* * Bittorrent Client using Qt and libtorrent. - * Copyright (C) 2014 Vladimir Golovnev + * Copyright (C) 2014-2023 Vladimir Golovnev * Copyright (C) 2006 Christophe Dumez * * This program is free software; you can redistribute it and/or @@ -59,6 +59,10 @@ #include #include +#ifdef Q_OS_WIN +#include +#endif + #ifdef QBT_STATIC_QT #include Q_IMPORT_PLUGIN(QICOPlugin) @@ -104,7 +108,12 @@ int main(int argc, char *argv[]) #endif // We must save it here because QApplication constructor may change it - bool isOneArg = (argc == 2); + const bool isOneArg = (argc == 2); + +#if !defined(DISABLE_GUI) && defined(Q_OS_WIN) + if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows10) + QApplication::setStyle(u"Fusion"_s); +#endif // `app` must be declared out of try block to allow display message box in case of exception std::unique_ptr app;