From acc26b65347a2116e6c7cb1ad83b77a6b697a9da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Br=C3=A6strup=20Sayoc?= Date: Thu, 12 Sep 2024 23:42:36 +0200 Subject: [PATCH] [Gui] Handle unset style preferences in clipboard about info FIxes #16391 --- src/Gui/Splashscreen.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp index 28ebd96d39..16db98b366 100644 --- a/src/Gui/Splashscreen.cpp +++ b/src/Gui/Splashscreen.cpp @@ -881,9 +881,25 @@ void AboutDialog::copyToClipboard() } str << "\n"; + // Add Stylesheet/Theme/Qtstyle information std::string styleSheet = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/MainWindow")->GetASCII("StyleSheet"); std::string theme = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/MainWindow")->GetASCII("Theme"); - std::string style = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/MainWindow")->GetASCII("QtStyle"); + + #if QT_VERSION >= QT_VERSION_CHECK(6, 1, 0) + std::string style = qApp->style()->name().toStdString(); + #else + std::string style = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/MainWindow")->GetASCII("QtStyle"); + if(style.empty()) { + style = "Qt default"; + } + #endif + + if(styleSheet.empty()) { + styleSheet = "unset"; + } + if(theme.empty()) { + theme = "unset"; + } str << "Stylesheet/Theme/QtStyle: " << QString::fromStdString(styleSheet) << "/"