summaryrefslogtreecommitdiffstats
path: root/main/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 31d92dbf..6456371f 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -6,6 +6,7 @@
#include <QApplication>
#include <QDir>
#include <QTranslator>
+#include <QtWidgets>
/*! \mainpage QtPass
*
@@ -101,6 +102,14 @@ int main(int argc, char *argv[]) {
QGuiApplication::setDesktopFileName("qtpass.desktop");
#endif
+
+ //Center the MainWindow on the screen the mouse pointer is currently on
+ static int cursorScreen = app.desktop()->screenNumber(app.desktop()->cursor().pos());
+ QPoint cursorScreenCenter = app.desktop()->screenGeometry(cursorScreen).center();
+ QRect windowFrameGeo = w.frameGeometry();
+ windowFrameGeo.moveCenter(cursorScreenCenter);
+ w.move(windowFrameGeo.topLeft());
+
w.show();
return SingleApplication::exec();