I am Using Qt 4.8 I am trying to bind mouse cursor to the center of my application.
If application is in fullscreen it works with following code
int middleX = QApplication::desktop()->width() >> 1;
int middleY = QApplication::desktop()->height() >> 1;
QPoint newMousePos;
newMousePos.setX(middleX);
newMousePos.setY(middleY);
QCursor::setPos(newMousePos);
and it works.
But how do I do this when application is not fullscreen mode? I tried few codes from the web but I could not found them working. I understand that I need to get current geometry of window i.e. current window position w.r.t. monitor and width and height of window.
but what are the functions to be used for that?
Thanks in advance