diff --git a/Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp b/Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp index 533fa5e55f..b043fbecba 100644 --- a/Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp +++ b/Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp @@ -7,10 +7,12 @@ #include #include +#include #include #include #include #include +#include #include #include @@ -30,6 +32,10 @@ #include "DolphinQt/QtUtils/ModalMessageBox.h" #include "DolphinQt/Settings.h" +static const QString RECORD_BUTTON_STYLESHEET = + QStringLiteral("QPushButton:checked { background-color: rgb(150, 0, 0); border-style: solid; " + "border-width: 3px; border-color: rgb(150,0,0); color: rgb(255, 255, 255);}"); + CodeDiffDialog::CodeDiffDialog(CodeWidget* parent) : QDialog(parent), m_code_widget(parent) { setWindowTitle(tr("Code Diff Tool")); @@ -54,9 +60,7 @@ void CodeDiffDialog::CreateWidgets() m_include_btn = new QPushButton(tr("Code has been executed")); m_record_btn = new QPushButton(tr("Start Recording")); m_record_btn->setCheckable(true); - m_record_btn->setStyleSheet( - QStringLiteral("QPushButton:checked { background-color: rgb(150, 0, 0); border-style: solid; " - "border-width: 3px; border-color: rgb(150,0,0); color: rgb(255, 255, 255);}")); + m_record_btn->setStyleSheet(RECORD_BUTTON_STYLESHEET); m_exclude_btn->setEnabled(false); m_include_btn->setEnabled(false); @@ -105,6 +109,13 @@ void CodeDiffDialog::CreateWidgets() void CodeDiffDialog::ConnectWidgets() { +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, + [this](Qt::ColorScheme colorScheme) { + m_record_btn->setStyleSheet(RECORD_BUTTON_STYLESHEET); + }); +#endif + connect(m_record_btn, &QPushButton::toggled, this, &CodeDiffDialog::OnRecord); connect(m_include_btn, &QPushButton::pressed, [this]() { Update(true); }); connect(m_exclude_btn, &QPushButton::pressed, [this]() { Update(false); }); diff --git a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp index edac049a96..cd93541736 100644 --- a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -161,6 +162,11 @@ CodeViewWidget::CodeViewWidget() : m_system(Core::System::GetInstance()) FontBasedSizing(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, + [this](Qt::ColorScheme colorScheme) { OnSelectionChanged(); }); +#endif + connect(this, &CodeViewWidget::customContextMenuRequested, this, &CodeViewWidget::OnContextMenu); connect(this, &CodeViewWidget::itemSelectionChanged, this, &CodeViewWidget::OnSelectionChanged); connect(&Settings::Instance(), &Settings::DebugFontChanged, this, &QWidget::setFont); 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 #include +#include #include #include #include #include #include +#include #include #include @@ -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); diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index c1566fb795..3c295c9d74 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -238,6 +239,13 @@ MainWindow::MainWindow(std::unique_ptr boot_parameters, ConnectMenuBar(); ConnectHotkeys(); +#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) + connect(QGuiApplication::styleHints(), &QStyleHints::colorSchemeChanged, this, + [](Qt::ColorScheme colorScheme) { + Settings::Instance().SetCurrentUserStyle(Settings::Instance().GetCurrentUserStyle()); + }); +#endif + connect(m_cheats_manager, &CheatsManager::OpenGeneralSettings, this, &MainWindow::ShowGeneralWindow);