mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-04 05:04:33 +00:00
Qt: Fix game list background on MacOS
This commit is contained in:
@@ -1930,7 +1930,7 @@ void GameListWidget::updateBackground(bool reload_image)
|
||||
m_ui.stack->setAutoFillBackground(true);
|
||||
m_list_view->setAlternatingRowColors(false);
|
||||
|
||||
if (QtHost::IsStyleSheetApplicationTheme())
|
||||
if (QtHost::HasGlobalStylesheet())
|
||||
{
|
||||
// Stylesheets override palette, so we need to set background: transparent on the grid and list view.
|
||||
const QString style_sheet = QStringLiteral("QAbstractScrollArea { background-color: transparent; }");
|
||||
|
||||
@@ -349,14 +349,11 @@ void UpdateApplicationTheme();
|
||||
bool IsDarkApplicationTheme();
|
||||
|
||||
/// Returns true if the application theme is using stylesheet overrides.
|
||||
bool IsStyleSheetApplicationTheme();
|
||||
bool HasGlobalStylesheet();
|
||||
|
||||
/// Sets the icon theme, based on the current style (light/dark).
|
||||
void UpdateThemeOnStyleChange();
|
||||
|
||||
/// Returns true if using the native theme and it has stylesheet overrides.
|
||||
bool NativeThemeStylesheetNeedsUpdate();
|
||||
|
||||
/// Sets batch mode (exit after game shutdown).
|
||||
bool InBatchMode();
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
namespace QtHost {
|
||||
static void SetThemeAttributes(bool is_stylesheet_theme, bool is_variable_color_theme, bool is_dark_theme);
|
||||
static bool NativeThemeStylesheetNeedsUpdate();
|
||||
static void SetStyleFromSettings();
|
||||
static QString GetNativeThemeStylesheet();
|
||||
|
||||
@@ -827,10 +828,14 @@ QTextBrowser {
|
||||
#endif
|
||||
else
|
||||
{
|
||||
SetThemeAttributes(false, true, false);
|
||||
const QString stylesheet = GetNativeThemeStylesheet();
|
||||
SetThemeAttributes(!stylesheet.isEmpty(), true, false);
|
||||
qApp->setStyle(s_state.unthemed_style_name);
|
||||
qApp->setPalette(s_state.unthemed_palette);
|
||||
qApp->setStyleSheet(GetNativeThemeStylesheet());
|
||||
|
||||
// Cleared above.
|
||||
if (!stylesheet.isEmpty())
|
||||
qApp->setStyleSheet(stylesheet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -847,7 +852,7 @@ bool QtHost::IsDarkApplicationTheme()
|
||||
return (palette.windowText().color().value() > palette.window().color().value());
|
||||
}
|
||||
|
||||
bool QtHost::IsStyleSheetApplicationTheme()
|
||||
bool QtHost::HasGlobalStylesheet()
|
||||
{
|
||||
return s_state.is_stylesheet_theme;
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ void QtUtils::SetMessageBoxStyle(QMessageBox* const dlg)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
// Can't have a stylesheet set even if it doesn't affect the widget.
|
||||
if (QtHost::IsStyleSheetApplicationTheme() || QtHost::NativeThemeStylesheetNeedsUpdate())
|
||||
if (QtHost::HasGlobalStylesheet())
|
||||
{
|
||||
dlg->setStyleSheet("");
|
||||
dlg->setAttribute(Qt::WA_StyleSheet, false);
|
||||
@@ -292,7 +292,7 @@ QMessageBox* QtUtils::NewMessageBox(QMessageBox::Icon icon, const QString& title
|
||||
|
||||
void QtUtils::StylePopupMenu(QMenu* menu)
|
||||
{
|
||||
if (QtHost::IsStyleSheetApplicationTheme())
|
||||
if (QtHost::HasGlobalStylesheet())
|
||||
{
|
||||
menu->setWindowFlags(menu->windowFlags() | Qt::NoDropShadowWindowHint | Qt::FramelessWindowHint);
|
||||
menu->setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
@@ -316,7 +316,7 @@ void QtUtils::StyleChildMenus(QWidget* widget)
|
||||
QMenu* QtUtils::NewPopupMenu(QWidget* parent, bool delete_on_close /*= true*/)
|
||||
{
|
||||
QMenu* menu = new QMenu(parent);
|
||||
if (QtHost::IsStyleSheetApplicationTheme())
|
||||
if (QtHost::HasGlobalStylesheet())
|
||||
{
|
||||
menu->setWindowFlags(menu->windowFlags() | Qt::NoDropShadowWindowHint | Qt::FramelessWindowHint);
|
||||
menu->setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
|
||||
Reference in New Issue
Block a user