Skip to content

Commit

Permalink
Debugger: Destroy and re-create the debugger on theme change
Browse files Browse the repository at this point in the history
  • Loading branch information
F0bes committed Oct 7, 2024
1 parent bba85dc commit 9243264
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pcsx2-qt/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1723,8 +1723,36 @@ void MainWindow::onCreateMemoryCardOpenRequested()

void MainWindow::updateTheme()
{
// The debugger hates theme changes.
// We have unfortunately to destroy it and recreate it.
const bool debugger_is_open = m_debugger_window ? m_debugger_window->isVisible() : false;
const QSize debugger_size = m_debugger_window ? m_debugger_window->size() : QSize();
const QPoint debugger_pos = m_debugger_window ? m_debugger_window->pos() : QPoint();
if (m_debugger_window)
{
if (QMessageBox::question(this, tr("Theme Change"),
tr("Changing the theme will close the debugger window. Any unsaved data will be lost. Do you want to continue?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
{
return;
}
}

QtHost::UpdateApplicationTheme();
reloadThemeSpecificImages();

if (m_debugger_window)
{
m_debugger_window->deleteLater();
m_debugger_window = nullptr;
getDebuggerWindow(); // populates m_debugger_window
m_debugger_window->resize(debugger_size);
m_debugger_window->move(debugger_pos);
if (debugger_is_open)
{
m_debugger_window->show();
}
}
}

void MainWindow::reloadThemeSpecificImages()
Expand Down

0 comments on commit 9243264

Please sign in to comment.