mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:50:06 +00:00 
			
		
		
		
	Add default style override in preparation for Qt 6.7
This commit is contained in:
		
							parent
							
								
									627f13043b
								
							
						
					
					
						commit
						3561e2948b
					
				
					 1 changed files with 41 additions and 1 deletions
				
			
		|  | @ -15,6 +15,9 @@ | ||||||
| #include <scwx/util/logger.hpp> | #include <scwx/util/logger.hpp> | ||||||
| #include <scwx/util/threads.hpp> | #include <scwx/util/threads.hpp> | ||||||
| 
 | 
 | ||||||
|  | #include <string> | ||||||
|  | #include <vector> | ||||||
|  | 
 | ||||||
| #include <aws/core/Aws.h> | #include <aws/core/Aws.h> | ||||||
| #include <boost/asio.hpp> | #include <boost/asio.hpp> | ||||||
| #include <fmt/format.h> | #include <fmt/format.h> | ||||||
|  | @ -26,8 +29,17 @@ | ||||||
| static const std::string logPrefix_ = "scwx::main"; | static const std::string logPrefix_ = "scwx::main"; | ||||||
| static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | static const auto        logger_    = scwx::util::Logger::Create(logPrefix_); | ||||||
| 
 | 
 | ||||||
|  | static void OverrideDefaultStyle(const std::vector<std::string>& args); | ||||||
|  | 
 | ||||||
| int main(int argc, char* argv[]) | int main(int argc, char* argv[]) | ||||||
| { | { | ||||||
|  |    // Store arguments
 | ||||||
|  |    std::vector<std::string> args {}; | ||||||
|  |    for (int i = 0; i < argc; ++i) | ||||||
|  |    { | ||||||
|  |       args.push_back(argv[i]); | ||||||
|  |    } | ||||||
|  | 
 | ||||||
|    // Initialize logger
 |    // Initialize logger
 | ||||||
|    scwx::util::Logger::Initialize(); |    scwx::util::Logger::Initialize(); | ||||||
|    spdlog::set_level(spdlog::level::debug); |    spdlog::set_level(spdlog::level::debug); | ||||||
|  | @ -87,7 +99,12 @@ int main(int argc, char* argv[]) | ||||||
|    // Theme
 |    // Theme
 | ||||||
|    auto uiStyle = scwx::qt::types::GetUiStyle( |    auto uiStyle = scwx::qt::types::GetUiStyle( | ||||||
|       scwx::qt::settings::GeneralSettings::Instance().theme().GetValue()); |       scwx::qt::settings::GeneralSettings::Instance().theme().GetValue()); | ||||||
|    if (uiStyle != scwx::qt::types::UiStyle::Default) | 
 | ||||||
|  |    if (uiStyle == scwx::qt::types::UiStyle::Default) | ||||||
|  |    { | ||||||
|  |       OverrideDefaultStyle(args); | ||||||
|  |    } | ||||||
|  |    else | ||||||
|    { |    { | ||||||
|       QApplication::setStyle( |       QApplication::setStyle( | ||||||
|          QString::fromStdString(scwx::qt::types::GetUiStyleName(uiStyle))); |          QString::fromStdString(scwx::qt::types::GetUiStyleName(uiStyle))); | ||||||
|  | @ -125,3 +142,26 @@ int main(int argc, char* argv[]) | ||||||
| 
 | 
 | ||||||
|    return result; |    return result; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | static void OverrideDefaultStyle(const std::vector<std::string>& args) | ||||||
|  | { | ||||||
|  | #if defined(_WIN32) | ||||||
|  |    bool hasStyleArgument = false; | ||||||
|  | 
 | ||||||
|  |    for (int i = 1; i < args.size(); ++i) | ||||||
|  |    { | ||||||
|  |       if (args.at(i) == "-style") | ||||||
|  |       { | ||||||
|  |          hasStyleArgument = true; | ||||||
|  |          break; | ||||||
|  |       } | ||||||
|  |    } | ||||||
|  | 
 | ||||||
|  |    // Override the default Windows 11 style unless the user supplies a style
 | ||||||
|  |    // argument
 | ||||||
|  |    if (!hasStyleArgument) | ||||||
|  |    { | ||||||
|  |       QApplication::setStyle("windowsvista"); | ||||||
|  |    } | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat