Skip to content

Commit c91e1dc

Browse files
RedBlackAkaCalcProgrammer1
authored andcommitted
Add fullscreen mode toggleable with F11
1 parent b2ea421 commit c91e1dc

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

qt/OpenRGBDialog2/OpenRGBDialog2.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <QMessageBox>
2929
#include <QCloseEvent>
3030
#include <QStyleFactory>
31+
#include <QKeyEvent>
3132
#include "OpenRGBFont.h"
3233

3334
#ifdef __APPLE__
@@ -665,6 +666,26 @@ void OpenRGBDialog2::closeEvent(QCloseEvent *event)
665666
}
666667
}
667668

669+
void OpenRGBDialog2::keyPressEvent(QKeyEvent *event)
670+
{
671+
if(event->key() == Qt::Key_F11)
672+
{
673+
if(isFullScreen())
674+
{
675+
showNormal();
676+
}
677+
else
678+
{
679+
showFullScreen();
680+
}
681+
event->accept();
682+
}
683+
else
684+
{
685+
QMainWindow::keyPressEvent(event);
686+
}
687+
}
688+
668689
bool OpenRGBDialog2::SelectConfigProfile(const std::string name)
669690
{
670691
/*-----------------------------------------------------*\

qt/OpenRGBDialog2/OpenRGBDialog2.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public slots:
8484
void SetTrayIcon(bool tray_icon);
8585
void handleAboutToQuit();
8686

87+
protected:
88+
void keyPressEvent(QKeyEvent *event) override;
89+
8790
private:
8891
const char* context = "Ui::OpenRGBDialog2";
8992

0 commit comments

Comments
 (0)