Skip to content

Commit

Permalink
Added fix for macOS fullscreen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
alanspencer committed Apr 12, 2020
1 parent 5861f95 commit d61ecc6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
23 changes: 23 additions & 0 deletions SPIERSview/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3981,6 +3981,21 @@ void MainWindow::on_actionFull_Screen_triggered()
#ifdef __linux__
fullScreenDialog->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
fullScreenDialog->show();

#elif __APPLE__
// MacOS is anoying! Need to get the mainn window geomtry when it is at full screen
// so need to know if it is already at full screen to return to it previous state on
// glwidget full screen close.
wasFullScreen = false;
if(isFullScreen()) {
wasFullScreen = true;
} else {
lastGeometry = geometry();
showFullScreen();
}
fullScreenDialog->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
fullScreenDialog->setGeometry(geometry());
fullScreenDialog->showFullScreen();
#else
fullScreenDialog->showFullScreen();
#endif
Expand All @@ -3992,6 +4007,14 @@ void MainWindow::on_actionFull_Screen_triggered()
ui->frameVTK->layout()->addWidget(gl3widget);
fullScreenDialog->close();
gl3widget->update();

#ifdef __APPLE__
// Return the main window back to it previosu state if needed
if(wasFullScreen == false) {
showNormal();
setGeometry(lastGeometry);
#endif

isGLFullScreen = false;

//qDebug() << "[Full Screen Mode] Closing full screen mode";
Expand Down
2 changes: 2 additions & 0 deletions SPIERSview/src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public slots:

bool mainWindowReady = false;
bool isGLFullScreen = false;
bool wasFullScreen = false;
QRect lastGeometry;

int specificprogress;
QString specificlabel;
Expand Down

0 comments on commit d61ecc6

Please sign in to comment.