summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2023-04-25 00:12:59 -0700
committerShawn Hoffman <godisgovernment@gmail.com>2023-04-25 12:34:34 -0700
commitbb227ad7bbf734a0efe29288e79f0d22654ee399 (patch)
treed23342856835b71df1abea8d9122d327a8f57ef8 /Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp
parent8c2e9242555bdcbaa0067658bf8a4a41d6936405 (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/CodeDiffDialog.cpp')
-rw-r--r--Source/Core/DolphinQt/Debugger/CodeDiffDialog.cpp17
1 files changed, 14 insertions, 3 deletions
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 <string>
#include <vector>
+#include <QGuiApplication>
#include <QHBoxLayout>
#include <QLabel>
#include <QMenu>
#include <QPushButton>
+#include <QStyleHints>
#include <QTableWidget>
#include <QVBoxLayout>
@@ -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); });