fix start pos possible bug
If you find a way to move the client windows out of screen
it will each time come back to that wrong position at start
This is a corner cases as Windows does not allow that (still
a weird bug allowed us to see it could happen)
Change-Id: I5d43943ec94617c7f496b5221518c30a99969aa1
Tuleap: #658
diff --git a/mainwindow.cpp b/mainwindow.cpp
index b72aecd..4570e37 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -19,7 +19,7 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
-#include <QSizeGrip>
+#include <QDesktopWidget>
#include "media/text.h"
#include "media/textrecording.h"
@@ -88,10 +88,13 @@
QSettings settings;
QVariant size = settings.value(SettingsKey::savedSize);
- QVariant pos = settings.value(SettingsKey::savedPos);
- if (size.isValid() && pos.isValid()) {
+ QVariant posV = settings.value(SettingsKey::savedPos);
+ if (size.isValid() && posV.isValid()) {
resize(size.toSize());
- move(pos.toPoint());
+ auto screenSize = QApplication::desktop()->screenGeometry();
+ auto pos = posV.toPoint();
+ if (pos.rx() < screenSize.width() && pos.ry() < screenSize.height())
+ move(pos);
} else
resize(1054, 600);