diff --git a/pcsx2-qt/Debugger/DebuggerWindow.cpp b/pcsx2-qt/Debugger/DebuggerWindow.cpp index f28547ae99f66..6e9a0ab6c5cca 100644 --- a/pcsx2-qt/Debugger/DebuggerWindow.cpp +++ b/pcsx2-qt/Debugger/DebuggerWindow.cpp @@ -42,11 +42,17 @@ DebuggerWindow::DebuggerWindow(QWidget* parent) connect(m_ui.actionStepInto, &QAction::triggered, this, &DebuggerWindow::onStepInto); connect(m_ui.actionStepOver, &QAction::triggered, this, &DebuggerWindow::onStepOver); connect(m_ui.actionStepOut, &QAction::triggered, this, &DebuggerWindow::onStepOut); + connect(m_ui.actionOnTop, &QAction::triggered, [this] { this->setWindowFlags(this->windowFlags() ^ Qt::WindowStaysOnTopHint); this->show(); }); connect(g_emu_thread, &EmuThread::onVMPaused, this, &DebuggerWindow::onVMStateChanged); connect(g_emu_thread, &EmuThread::onVMResumed, this, &DebuggerWindow::onVMStateChanged); onVMStateChanged(); // If we missed a state change while we weren't loaded + + // We can't do this in the designer, but we want to right align the actionOnTop action in the toolbar + QWidget* spacer = new QWidget(this); + spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + m_ui.toolBar->insertWidget(m_ui.actionOnTop, spacer); m_cpuWidget_r5900 = new CpuWidget(this, r5900Debug); m_cpuWidget_r3000 = new CpuWidget(this, r3000Debug); diff --git a/pcsx2-qt/Debugger/DebuggerWindow.ui b/pcsx2-qt/Debugger/DebuggerWindow.ui index ac1aabe1c268f..71a692187ca0c 100644 --- a/pcsx2-qt/Debugger/DebuggerWindow.ui +++ b/pcsx2-qt/Debugger/DebuggerWindow.ui @@ -13,6 +13,11 @@ PCSX2 Debugger + + + :/icons/AppIcon64.png + + @@ -46,6 +51,7 @@ + @@ -88,6 +94,17 @@ Shift+F11 + + + true + + + Always On Top + + + Show this window on top + + diff --git a/pcsx2-qt/MainWindow.cpp b/pcsx2-qt/MainWindow.cpp index cb718dba7c44b..cc68ba0e99023 100644 --- a/pcsx2-qt/MainWindow.cpp +++ b/pcsx2-qt/MainWindow.cpp @@ -118,6 +118,13 @@ MainWindow::~MainWindow() // make sure the game list isn't refreshing, because it's on a separate thread cancelGameListRefresh(); + if (m_debugger_window) + { + m_debugger_window->close(); + m_debugger_window->deleteLater(); + m_debugger_window = nullptr; + } + // we compare here, since recreate destroys the window later if (g_main_window == this) g_main_window = nullptr; @@ -2300,7 +2307,8 @@ void MainWindow::doSettings(const char* category /* = nullptr */) DebuggerWindow* MainWindow::getDebuggerWindow() { if (!m_debugger_window) - m_debugger_window = new DebuggerWindow(this); + // Don't pass us (this) as the parent, otherwise the window is always on top of the mainwindow (on windows at least) + m_debugger_window = new DebuggerWindow(nullptr); return m_debugger_window; }