File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -238,6 +238,12 @@ int DebuggerWindow::fontSize()
238238
239239void DebuggerWindow::updateTheme ()
240240{
241+ // Detect recursive StyleChange events caused by updating the stylesheet.
242+ if (m_is_updating_theme)
243+ return ;
244+
245+ m_is_updating_theme = true ;
246+
241247 // TODO: Migrate away from stylesheets to improve performance.
242248 setStyleSheet (QString (" font-size: %1pt;" ).arg (m_font_size));
243249
@@ -248,6 +254,8 @@ void DebuggerWindow::updateTheme()
248254 setStyleSheet (QString ());
249255
250256 dockManager ().updateTheme ();
257+
258+ m_is_updating_theme = false ;
251259}
252260
253261void DebuggerWindow::saveWindowGeometry ()
@@ -535,6 +543,12 @@ void DebuggerWindow::onStepOut()
535543 this ->repaint ();
536544}
537545
546+ void DebuggerWindow::changeEvent (QEvent* event)
547+ {
548+ if (event->type () == QEvent::PaletteChange || event->type () == QEvent::StyleChange)
549+ updateTheme ();
550+ }
551+
538552void DebuggerWindow::closeEvent (QCloseEvent* event)
539553{
540554 dockManager ().saveCurrentLayout ();
Original file line number Diff line number Diff line change @@ -60,7 +60,8 @@ public slots:
6060 void onVMActuallyPaused ();
6161
6262protected:
63- void closeEvent (QCloseEvent* event);
63+ void changeEvent (QEvent* event) override ;
64+ void closeEvent (QCloseEvent* event) override ;
6465
6566private:
6667 DebugInterface* currentCPU ();
@@ -75,6 +76,8 @@ public slots:
7576 int m_font_size;
7677 static const constexpr int MINIMUM_FONT_SIZE = 5 ;
7778 static const constexpr int MAXIMUM_FONT_SIZE = 30 ;
79+
80+ bool m_is_updating_theme = false ;
7881};
7982
8083extern DebuggerWindow* g_debugger_window;
Original file line number Diff line number Diff line change @@ -1796,9 +1796,6 @@ void MainWindow::updateTheme()
17961796{
17971797 QtHost::UpdateApplicationTheme ();
17981798 reloadThemeSpecificImages ();
1799-
1800- if (g_debugger_window)
1801- g_debugger_window->updateTheme ();
18021799}
18031800
18041801void MainWindow::reloadThemeSpecificImages ()
You can’t perform that action at this time.
0 commit comments