Core: Add "UI configuration" section to System Information

"System Information..." provides the output of qtdiag. Among other info,
it contains DPRs and font DPIs. With support of the DPI rounding policy,
those values may deviate the IDE process. This makes the "System
Information..." output in a bug report potentially lack relevant
information.

Also, the StyleHelper::UiElement* font may vary depending on DPR/DPI and
other system settings. Since these fonts are used in the Welcome screen
redesign, precise information of these fonts is missed in reports
regarding the redesign.

This change adds a "UI configuration" section to System Information. It
contains most data from the "Environment -> Interface" settings page,
and in addition a dump of all StyleHelper::UiElement fonts.

Task-number: QTCREATORBUG-30579
Task-number: QTCREATORBUG-30637
Task-number: QTCREATORBUG-30650
Change-Id: Iff2c58903c5f8d5dbae4884b0521a8b85469b188
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2024-04-09 16:07:42 +02:00
parent 0d17a1e6fd
commit 82703befa1

View File

@@ -1035,12 +1035,57 @@ void ICore::addPreCloseListener(const std::function<bool ()> &listener)
d->m_preCloseListeners.append(listener);
}
QString uiConfigInformation()
{
QString info("UI configuration:\n\n");
info.append(QString("Color: %1\n").arg(StyleHelper::requestedBaseColor().name()));
info.append(QString("Theme: %1 \"%2\"\n").arg(creatorTheme()->id())
.arg(creatorTheme()->displayName()));
const QString toolbarStyle =
StyleHelper::toolbarStyle() == StyleHelper::ToolbarStyleCompact ? "Compact" : "Relaxed";
info.append(QString("Toolbar style: Utils::StyleHelper::ToolbarStyle%1\n").arg(toolbarStyle));
const QString policy =
QVariant::fromValue(QApplication::highDpiScaleFactorRoundingPolicy()).toString();
QString userInterfaceLanguage = ICore::userInterfaceLanguage();
if (userInterfaceLanguage.isEmpty())
userInterfaceLanguage = QLocale::system().name() + " (System Language)";
info.append(QString("Language: %1\n").arg(userInterfaceLanguage));
info.append(QString("Device pixel ratio: %1, Qt::HighDpiScaleFactorRoundingPolicy::%2\n")
.arg(qApp->devicePixelRatio()).arg(policy));
info.append(QString("Font DPI: %1\n").arg(qApp->fontMetrics().fontDpi()));
info.append(QString("Utils::StyleHelper::UiElement:\n"));
#define QTC_ADD_UIELEMENT_FONT(uiElement) ( \
info.append(QString(" %1: %2\n").arg(#uiElement) \
.arg(StyleHelper::uiFont(StyleHelper::UiElement##uiElement).toString())) \
);
QTC_ADD_UIELEMENT_FONT(H1);
QTC_ADD_UIELEMENT_FONT(H2);
QTC_ADD_UIELEMENT_FONT(H3);
QTC_ADD_UIELEMENT_FONT(H4);
QTC_ADD_UIELEMENT_FONT(H5);
QTC_ADD_UIELEMENT_FONT(H6);
QTC_ADD_UIELEMENT_FONT(H6Capital);
QTC_ADD_UIELEMENT_FONT(Body1);
QTC_ADD_UIELEMENT_FONT(Body2);
QTC_ADD_UIELEMENT_FONT(ButtonMedium);
QTC_ADD_UIELEMENT_FONT(ButtonSmall);
QTC_ADD_UIELEMENT_FONT(CaptionStrong);
QTC_ADD_UIELEMENT_FONT(Caption);
QTC_ADD_UIELEMENT_FONT(IconStandard);
QTC_ADD_UIELEMENT_FONT(IconActive);
#undef QTC_ADD_UIELEMENT_FONT
return info;
}
/*!
\internal
*/
QString ICore::systemInformation()
{
return PluginManager::systemInformation() + '\n' + aboutInformationCompact() + '\n';
return PluginManager::systemInformation() + '\n' + uiConfigInformation() + '\n'
+ aboutInformationCompact() + '\n';
}
static const QString &screenShotsPath()