Is there any way to get the exact coordinate on the other machine?
When the monitor sizes and resolutions can differ, you cannot rely on the exact coordinate, you should convert the coordinates in to relative (say % of width, % of height) cooridinates and then sedn them across to other machine.
On source machine
QPoint point
= event
->globalPos
();
QSize size
= qApp
->desktop
()->screen
()->size
();
point.setX(100 * point.x() / size.width());
point.setY(100 * point.y() / size.height());
// send point
QMouseEvent * event;
QPoint point = event->globalPos();
QSize size = qApp->desktop()->screen()->size();
point.setX(100 * point.x() / size.width());
point.setY(100 * point.y() / size.height());
// send point
To copy to clipboard, switch view to plain text mode
On destination machine
// receive point
QSize size
= qApp
->desktop
()->screen
()->size
();
point.setX(size.width() * point.x() / 100);
point.setY(size.height() * point.y() / 100);
//use the point
QPoint point;
// receive point
QSize size = qApp->desktop()->screen()->size();
point.setX(size.width() * point.x() / 100);
point.setY(size.height() * point.y() / 100);
//use the point
To copy to clipboard, switch view to plain text mode
Bookmarks