Application window on Multi monitor screen and centre placement
I've a QMainWindow, which is launched by another application.
The problem is, in a multimonitor setup, the application launching my QMainWindow, might reside on the 3rd screen, but my window will always launch on the first.
I worked around this in the following way...
QDesktopWidget *m = new QDesktopWidget();
QPoint p= QCursor::pos();
int r= m->screenNumber(p); //get the screennumber where the mouse is
QPoint l = d.center(); //not the correct solution
mainWin->move(l); //move the window to that screen
Now, how do I launch this window in the centre of the scree.
d.center()is not the correct way, as the topleft of the window will launch from the centre point, so it will be obscured.
from the top of my head something like that:
QRect mainWinGeometry = mainWin->geometry();
Hope it helps