diff options
| author | Shawn Hoffman <godisgovernment@gmail.com> | 2023-04-25 00:12:59 -0700 |
|---|---|---|
| committer | Shawn Hoffman <godisgovernment@gmail.com> | 2023-04-25 12:34:34 -0700 |
| commit | bb227ad7bbf734a0efe29288e79f0d22654ee399 (patch) | |
| tree | d23342856835b71df1abea8d9122d327a8f57ef8 /Source/Core/DolphinQt/Debugger/CodeWidget.cpp | |
| parent | 8c2e9242555bdcbaa0067658bf8a4a41d6936405 (diff) | |
DolphinQt: reset stylesheets on colorSchemeChanged
This is required for switching system color scheme
(dark/light) dynamically at runtime.
Diffstat (limited to 'Source/Core/DolphinQt/Debugger/CodeWidget.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Debugger/CodeWidget.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Source/Core/DolphinQt/Debugger/CodeWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeWidget.cpp index 1f82c969de..4315196996 100644 --- a/Source/Core/DolphinQt/Debugger/CodeWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/CodeWidget.cpp @@ -9,11 +9,13 @@ #include <QGridLayout> #include <QGroupBox> +#include <QGuiApplication> #include <QLabel> #include <QLineEdit> #include <QListWidget> #include <QPushButton> #include <QSplitter> +#include <QStyleHints> #include <QTableWidget> #include <QWidget> @@ -28,6 +30,10 @@ #include "DolphinQt/Host.h" #include "DolphinQt/Settings.h" +static const QString BOX_SPLITTER_STYLESHEET = QStringLiteral( + "QSplitter::handle { border-top: 1px dashed black; width: 1px; margin-left: 10px; " + "margin-right: 10px; }"); + CodeWidget::CodeWidget(QWidget* parent) : QDockWidget(parent), m_system(Core::System::GetInstance()) { setWindowTitle(tr("Code")); @@ -104,9 +110,7 @@ void CodeWidget::CreateWidgets() m_search_address->setPlaceholderText(tr("Search Address")); m_box_splitter = new QSplitter(Qt::Vertical); - m_box_splitter->setStyleSheet(QStringLiteral( - "QSplitter::handle { border-top: 1px dashed black; width: 1px; margin-left: 10px; " - "margin-right: 10px; }")); + m_box_splitter->setStyleSheet(BOX_SPLITTER_STYLESHEET); auto add_search_line_edit = [this](const QString& name, QListWidget* list_widget) { auto* widget = new QWidget; @@ -154,6 +158,13 @@ void CodeWidget::CreateWidgets() void CodeWidget::ConnectWidgets() { +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, + [this](Qt::ColorScheme colorScheme) { + m_box_splitter->setStyleSheet(BOX_SPLITTER_STYLESHEET); + }); +#endif + connect(m_search_address, &QLineEdit::textChanged, this, &CodeWidget::OnSearchAddress); connect(m_search_address, &QLineEdit::returnPressed, this, &CodeWidget::OnSearchAddress); connect(m_search_symbols, &QLineEdit::textChanged, this, &CodeWidget::OnSearchSymbols); |
