App: Running FreeCAD in verbose mode information to reflect Gui -> Help -> About Dialog info (#20487)

This commit is contained in:
Alex Tran
2025-04-15 23:29:07 -07:00
committed by GitHub
parent 4c09e6c3d9
commit 989a06ea63
7 changed files with 354 additions and 293 deletions

View File

@@ -35,6 +35,7 @@
#include <QMessageLogContext>
#include <QRegularExpression>
#include <QRegularExpressionMatch>
#include <QScreen>
#include <QStatusBar>
#include <QStyle>
#include <QTextStream>
@@ -2631,3 +2632,44 @@ App::Document* Application::reopen(App::Document* doc)
}
return doc;
}
void Application::getVerboseDPIStyleInfo(QTextStream& str) {
// 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");
#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) << "/"
<< QString::fromStdString(theme) << "/" << QString::fromStdString(style) << "\n";
// Add DPI information
str << "Logical DPI/Physical DPI/Pixel Ratio: "
<< QApplication::primaryScreen()->logicalDotsPerInch()
<< "/"
<< QApplication::primaryScreen()->physicalDotsPerInch()
<< "/"
<< QApplication::primaryScreen()->devicePixelRatio()
<< "\n";
}