From e58c5ec11bf16be91da03495bc86958a588d4027 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Fri, 5 Jan 2018 03:09:44 +0100 Subject: [PATCH] Fix window geometry loading Fixes #181 --- src/widgets/window.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/widgets/window.cpp b/src/widgets/window.cpp index f6d1b73df..24c15fcc3 100644 --- a/src/widgets/window.cpp +++ b/src/widgets/window.cpp @@ -116,15 +116,27 @@ void Window::refreshTheme() void Window::loadGeometry() { + bool doSetGeometry = false; + QRect loadedGeometry; if (!this->windowGeometry.x.isDefaultValue() && !this->windowGeometry.y.isDefaultValue()) { - this->move(this->windowGeometry.x, this->windowGeometry.y); + loadedGeometry.setX(this->windowGeometry.x); + loadedGeometry.setY(this->windowGeometry.y); + doSetGeometry = true; } if (!this->windowGeometry.width.isDefaultValue() && !this->windowGeometry.height.isDefaultValue()) { - this->resize(this->windowGeometry.width, this->windowGeometry.height); + loadedGeometry.setWidth(this->windowGeometry.width); + loadedGeometry.setHeight(this->windowGeometry.height); } else { - this->resize(1280, 800); + loadedGeometry.setWidth(1280); + loadedGeometry.setHeight(720); + } + + if (doSetGeometry) { + this->setGeometry(loadedGeometry); + } else { + this->resize(loadedGeometry.width(), loadedGeometry.height()); } }