From c91e1dcdd9d6ab9fcd80e60af75ce74e3170e27f Mon Sep 17 00:00:00 2001 From: RedBlackAka Date: Sun, 5 Jan 2025 22:48:31 +0000 Subject: [PATCH] Add fullscreen mode toggleable with F11 --- qt/OpenRGBDialog2/OpenRGBDialog2.cpp | 21 +++++++++++++++++++++ qt/OpenRGBDialog2/OpenRGBDialog2.h | 3 +++ 2 files changed, 24 insertions(+) diff --git a/qt/OpenRGBDialog2/OpenRGBDialog2.cpp b/qt/OpenRGBDialog2/OpenRGBDialog2.cpp index 52fbd92e..dfb07944 100644 --- a/qt/OpenRGBDialog2/OpenRGBDialog2.cpp +++ b/qt/OpenRGBDialog2/OpenRGBDialog2.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "OpenRGBFont.h" #ifdef __APPLE__ @@ -665,6 +666,26 @@ void OpenRGBDialog2::closeEvent(QCloseEvent *event) } } +void OpenRGBDialog2::keyPressEvent(QKeyEvent *event) +{ + if(event->key() == Qt::Key_F11) + { + if(isFullScreen()) + { + showNormal(); + } + else + { + showFullScreen(); + } + event->accept(); + } + else + { + QMainWindow::keyPressEvent(event); + } +} + bool OpenRGBDialog2::SelectConfigProfile(const std::string name) { /*-----------------------------------------------------*\ diff --git a/qt/OpenRGBDialog2/OpenRGBDialog2.h b/qt/OpenRGBDialog2/OpenRGBDialog2.h index bfba91d3..761dd046 100644 --- a/qt/OpenRGBDialog2/OpenRGBDialog2.h +++ b/qt/OpenRGBDialog2/OpenRGBDialog2.h @@ -84,6 +84,9 @@ public slots: void SetTrayIcon(bool tray_icon); void handleAboutToQuit(); +protected: + void keyPressEvent(QKeyEvent *event) override; + private: const char* context = "Ui::OpenRGBDialog2";