From 85baf0c7fb6dc638fba5b432c701e00fdbfd1cbc Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Tue, 5 Jul 2022 17:57:25 +0600 Subject: [PATCH] qt: Restore Close button on monitor windows --- src/qt/qt_mainwindow.cpp | 2 +- src/qt/qt_rendererstack.cpp | 7 +++++++ src/qt/qt_rendererstack.hpp | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 89d33f4ee..a894eb9a4 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -583,7 +583,7 @@ void MainWindow::initRendererMonitorSlot(int monitor_index) { this->renderers[monitor_index]->show(); }); - secondaryRenderer->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint); + secondaryRenderer->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); secondaryRenderer->setWindowTitle(QObject::tr("86Box Monitor #") + QString::number(monitor_index + 1)); if (vid_resize == 2) { diff --git a/src/qt/qt_rendererstack.cpp b/src/qt/qt_rendererstack.cpp index fd477416b..1d5a3cd3d 100644 --- a/src/qt/qt_rendererstack.cpp +++ b/src/qt/qt_rendererstack.cpp @@ -443,3 +443,10 @@ RendererStack::blitCommon(int x, int y, int w, int h) emit blitToRenderer(currentBuf, sx, sy, sw, sh); currentBuf = (currentBuf + 1) % imagebufs.size(); } + +void RendererStack::closeEvent(QCloseEvent* event) +{ + event->ignore(); + main_window->close(); +} + diff --git a/src/qt/qt_rendererstack.hpp b/src/qt/qt_rendererstack.hpp index bc6895f15..684a884da 100644 --- a/src/qt/qt_rendererstack.hpp +++ b/src/qt/qt_rendererstack.hpp @@ -31,6 +31,7 @@ public: void mouseMoveEvent(QMouseEvent *event) override; void wheelEvent(QWheelEvent *event) override; void leaveEvent(QEvent *event) override; + void closeEvent(QCloseEvent *event) override; void keyPressEvent(QKeyEvent *event) override { event->ignore();