diff --git a/MainWindow.cpp b/MainWindow.cpp index d353685..fb6a404 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -1631,7 +1631,7 @@ void MainWindow::createActions() connect(outputFullScreenAction, SIGNAL(toggled(bool)), outputWindow, SLOT(setFullScreen(bool))); // When closing the GL output window or hit ESC key, uncheck the action in menu. // connect(outputWindow, SIGNAL(closed()), outputFullScreenAction, SLOT(toggle())); - connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(updateOutputAction(int))); + connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), outputWindow, SLOT(updateScreenCount(int))); // Create hiden action for closing output window QAction *closeOutput = new QAction(tr("Close output"), this); closeOutput->setShortcut(Qt::Key_Escape); diff --git a/OutputGLWindow.cpp b/OutputGLWindow.cpp index ee80a43..21941cb 100644 --- a/OutputGLWindow.cpp +++ b/OutputGLWindow.cpp @@ -65,10 +65,7 @@ void OutputGLWindow::setFullScreen(bool fullscreen) { if (fullscreen) { - // Check if user is on multiple screen (always pre - int screen = _getPreferredScreen(); - //Move window to second screen before fullscreening it. - setGeometry(QApplication::desktop()->screenGeometry(screen)); + _updateToPreferredScreen(); #ifdef Q_OS_LINUX // The problem related to the full screen on linux seems to be resolved with Qt 5.5 on Debian. // However this still seems to be needed on Ubuntu 15.10. @@ -84,6 +81,21 @@ void OutputGLWindow::setFullScreen(bool fullscreen) } } +void OutputGLWindow::updateScreenCount(int nScreens) +{ + Q_UNUSED(nScreens); + // Untested. + _updateToPreferredScreen(); +} + +void OutputGLWindow::_updateToPreferredScreen() +{ + // Check if user is on multiple screen (always pre + int screen = _getPreferredScreen(); + //Move window to second screen before fullscreening it. + setGeometry(QApplication::desktop()->screenGeometry(screen)); +} + void OutputGLWindow::setDisplayCrosshair(bool crosshair) { diff --git a/OutputGLWindow.h b/OutputGLWindow.h index 6215aa2..fca9c14 100644 --- a/OutputGLWindow.h +++ b/OutputGLWindow.h @@ -46,10 +46,10 @@ public: public slots: void setFullScreen(bool fullScreen); + void updateScreenCount(int nScreens); void setDisplayCrosshair(bool crosshair); void setDisplayTestSignal(bool displayTestSignal); - signals: void closed(); @@ -63,6 +63,7 @@ private: int _getPreferredScreen() const { return QApplication::desktop()->screenCount()-1; } + void _updateToPreferredScreen(); }; MM_END_NAMESPACE