mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-05 18:10:17 +02:00
Merge pull request #4275 from ctrlaltdavid/20306
CR for Job #20306 - When you load Interface on a PC if takes up the entire screen, this needs to change
This commit is contained in:
commit
5553f0f531
3 changed files with 16 additions and 4 deletions
|
@ -516,7 +516,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
|
|
||||||
void Application::aboutToQuit() {
|
void Application::aboutToQuit() {
|
||||||
_aboutToQuit = true;
|
_aboutToQuit = true;
|
||||||
setFullscreen(false); // if you exit while in full screen, you'll get bad behavior when you restart.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
|
|
|
@ -24,7 +24,8 @@
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget* parent) :
|
MainWindow::MainWindow(QWidget* parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
_windowGeometry("WindowGeometry")
|
_windowGeometry("WindowGeometry"),
|
||||||
|
_windowState("WindowState", 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,13 +35,24 @@ void MainWindow::restoreGeometry() {
|
||||||
QRect geometry = _windowGeometry.get(qApp->desktop()->availableGeometry());
|
QRect geometry = _windowGeometry.get(qApp->desktop()->availableGeometry());
|
||||||
move(geometry.topLeft());
|
move(geometry.topLeft());
|
||||||
resize(geometry.size());
|
resize(geometry.size());
|
||||||
|
|
||||||
|
// Restore to maximized or full screen after restoring to windowed so that going windowed goes to good position and sizes.
|
||||||
|
Qt::WindowStates state = (Qt::WindowStates)_windowState.get(Qt::WindowNoState);
|
||||||
|
if (state != Qt::WindowNoState) {
|
||||||
|
setWindowState(state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::saveGeometry() {
|
void MainWindow::saveGeometry() {
|
||||||
// Did not use geometry() on purpose,
|
// Did not use geometry() on purpose,
|
||||||
// see http://doc.qt.io/qt-5/qsettings.html#restoring-the-state-of-a-gui-application
|
// see http://doc.qt.io/qt-5/qsettings.html#restoring-the-state-of-a-gui-application
|
||||||
QRect geometry(pos(), size());
|
_windowState.set((int)windowState());
|
||||||
_windowGeometry.set(geometry);
|
|
||||||
|
// Save position and size only if windowed so that have good values for windowed after starting maximized or full screen.
|
||||||
|
if (windowState() == Qt::WindowNoState) {
|
||||||
|
QRect geometry(pos(), size());
|
||||||
|
_windowGeometry.set(geometry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::moveEvent(QMoveEvent* event) {
|
void MainWindow::moveEvent(QMoveEvent* event) {
|
||||||
|
|
|
@ -38,6 +38,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Setting::Handle<QRect> _windowGeometry;
|
Setting::Handle<QRect> _windowGeometry;
|
||||||
|
Setting::Handle<int> _windowState;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__hifi__MainWindow__) */
|
#endif /* defined(__hifi__MainWindow__) */
|
||||||
|
|
Loading…
Reference in a new issue