summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2025-09-09 12:22:51 -0500
committerJordan Woyak <jordan.woyak@gmail.com>2025-09-09 16:47:30 -0500
commitecb568c45ac0cd7239690e7d7ae1719f9fd10b95 (patch)
treeb363ae29b3f014f97284e551a8767dd7c9c1d12e /Source/Core
parentf66bee48e417e6c7f250beb8e8038c32cd3adfb6 (diff)
DolphinQt: Clean up some of the style sheet hacks in StackedSettingsWindow.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinQt/Config/SettingsWindow.cpp43
1 files changed, 15 insertions, 28 deletions
diff --git a/Source/Core/DolphinQt/Config/SettingsWindow.cpp b/Source/Core/DolphinQt/Config/SettingsWindow.cpp
index af7b68445e..a1279c5eb5 100644
--- a/Source/Core/DolphinQt/Config/SettingsWindow.cpp
+++ b/Source/Core/DolphinQt/Config/SettingsWindow.cpp
@@ -46,46 +46,32 @@ StackedSettingsWindow::StackedSettingsWindow(QWidget* parent) : QDialog{parent}
m_navigation_list->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
// FYI: "base" is the window color on Windows and "alternate-base" is very high contrast on macOS.
- const auto [list_background, list_hover_background] =
-#if defined(_WIN32)
- std::pair("palette(alternate-base)", "palette(base)");
+ const auto* const list_background =
+#if !defined(__APPLE__)
+ "palette(alternate-base)";
#else
- std::pair("palette(base)", "palette(alternate-base)");
+ "palette(base)";
#endif
m_navigation_list->setStyleSheet(
QString::fromUtf8(
// Remove border around entire widget and adjust background color.
"QListWidget { border: 0; background: %1; } "
- "QListWidget::item { padding: %2; "
-#if defined(__linux__)
- "} "
-#else
- // For some reason this is needed to fix inconsistent item padding on Windows and macOS,
- // but it unfortunately also breaks item background color changes.
- "border: 0; } "
- // Restore selected item color.
+ // Note: padding-left is broken unless border is set, which then breaks colors.
+ // see: https://bugreports.qt.io/browse/QTBUG-122698
+ "QListWidget::item { padding-top: %2px; padding-bottom: %2px; } "
+ // Maintain selected item color when unfocused.
"QListWidget::item:selected { background: palette(highlight); "
-#if defined(_WIN32)
- // Prevent text color change on focus loss on Windows.
+#if !defined(__APPLE__)
+ // Prevent text color change on focus loss.
// This seems to breaks the nice white text on macOS.
"color: palette(highlighted-text); "
#endif
"} "
- // Restore hovered item color, though not really the correct color.
- "QListWidget::item:hover:!selected { background: %3; } "
-#endif
-#if defined(_WIN32)
- // Remove ugly dotted outline on selected row.
- "* { outline: none; } "
-#endif
- )
+ // Remove ugly dotted outline on selected row (Windows and GNOME).
+ "* { outline: none; } ")
.arg(QString::fromUtf8(list_background))
- .arg(list_item_padding)
-#if !defined(__linux__)
- .arg(QString::fromUtf8(list_hover_background))
-#endif
- );
+ .arg(list_item_padding));
layout->addWidget(m_navigation_list);
@@ -120,7 +106,8 @@ void StackedSettingsWindow::OnDoneCreatingPanes()
void StackedSettingsWindow::AddPane(QWidget* widget, const QString& name)
{
m_stacked_panes->addWidget(widget);
- m_navigation_list->addItem(name);
+ // Pad the left and right of each item.
+ m_navigation_list->addItem(QStringLiteral(" %1 ").arg(name));
}
void StackedSettingsWindow::AddWrappedPane(QWidget* widget, const QString& name)