mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[Style] Warn about the broken Windows native styles and stop resolving System to them (#7461)
* [Style] Fall back to the built-in windows style instead of windowsvista The Windows Vista native style is broken the same way as the Windows 11 one, so the sanitizer now catches both and falls back to the built-in QWindowsStyle instead of the Vista plugin. The style picker no longer offers either. * [Style] Keep Windows native styles selectable but warn about them --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
205e1ecebf
commit
6bed5d6f67
3 changed files with 38 additions and 17 deletions
|
|
@ -111,12 +111,17 @@ struct PaletteColorInfo
|
|||
|
||||
static QString usableDefaultStyle(const QString &style)
|
||||
{
|
||||
// The Windows 11 native style is broken: dragging cards across zones can
|
||||
// Only the OS/default ("System") style is sanitized: the Windows 11 and
|
||||
// Windows Vista native styles are broken (dragging cards across zones can
|
||||
// shrink the board to a tiny grey window that is unfixable without
|
||||
// rejoining. It is never usable, so guard against it no matter how it was
|
||||
// requested (OS default or an explicit "windows11" theme choice) and fall
|
||||
// back to the Vista style.
|
||||
return style.compare("windows11", Qt::CaseInsensitive) == 0 ? QStringLiteral("windowsvista") : style;
|
||||
// rejoining), so a "System" choice falls through to the built-in "windows"
|
||||
// style (QWindowsStyle) instead. They remain selectable by hand, where the
|
||||
// settings page warns about them.
|
||||
if (style.compare("windows11", Qt::CaseInsensitive) == 0 ||
|
||||
style.compare("windowsvista", Qt::CaseInsensitive) == 0) {
|
||||
return QStringLiteral("windows");
|
||||
}
|
||||
return style;
|
||||
}
|
||||
|
||||
ThemeManager::ThemeManager(QObject *parent) : QObject(parent)
|
||||
|
|
@ -496,14 +501,13 @@ void ThemeManager::applyStyleAndPalette(const QString &themeName,
|
|||
if (themeName == FUSION_THEME_NAME) {
|
||||
styleName = "Fusion";
|
||||
} else {
|
||||
// "System" resolves through the guard, which steers the broken
|
||||
// Windows native styles to "windows". An explicitly chosen style
|
||||
// name is honored as-is.
|
||||
styleName = usableDefaultStyle(defaultStyleName);
|
||||
}
|
||||
}
|
||||
|
||||
// The Windows 11 style is broken even when selected explicitly in a theme,
|
||||
// so sanitize the resolved name here rather than trusting the theme config.
|
||||
styleName = usableDefaultStyle(styleName);
|
||||
|
||||
QStyle *style = QStyleFactory::create(styleName);
|
||||
if (!style) {
|
||||
style = QStyleFactory::create(usableDefaultStyle(defaultStyleName));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue