From eede8f0f169ad58769175886eeba9e01bdc9b052 Mon Sep 17 00:00:00 2001 From: baydam Date: Tue, 21 Oct 2014 17:39:00 +0000 Subject: [PATCH] Fix issue Escape should make the output window fullscreen #46 and Hide cursor when the mouse is idle in fullscreen mode #39 --- OutputGLWindow.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/OutputGLWindow.cpp b/OutputGLWindow.cpp index 4a58770..2b68991 100644 --- a/OutputGLWindow.cpp +++ b/OutputGLWindow.cpp @@ -65,17 +65,21 @@ void OutputGLWindow::closeEvent(QCloseEvent *event) void OutputGLWindow::keyPressEvent(QKeyEvent *event) { // Escape from full screen mode. - if (event->key() == Qt::Key_Escape) + if (isFullScreen()) { - if (isFullScreen()) + if (event->key() == Qt::Key_Escape) { setFullScreen(false); emit fullScreenToggled(false); - } else { - setFullScreen(true); - emit fullScreenToggled(true); } + else + { + setFullScreen(true); + emit fullScreenToggled(true); + } + } + else { QDialog::keyPressEvent(event); @@ -98,6 +102,9 @@ void OutputGLWindow::setFullScreen(bool fullscreen) // Save window geometry. _geometry = saveGeometry(); + //hide cursor + this->setCursorVisible(false); + // Move window to second screen before fullscreening it. if (QApplication::desktop()->screenCount() > 1) setGeometry(QApplication::desktop()->screenGeometry(1)); @@ -120,6 +127,9 @@ void OutputGLWindow::setFullScreen(bool fullscreen) // Restore geometry of window to what it was before full screen call. restoreGeometry(_geometry); + // Show cursor + this->setCursorVisible(true); + #ifdef Q_OS_UNIX // Special case for Unity. if (session == "ubuntu" || session == "gnome") {