Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.2
-
None
Description
Disclaimer: I have alredy tried to ask this question to the user comunity (StackOverflow, Qt Forum), but had no answer to the problem, so i hope the development team would help me to solve the issue.
The issue
The general problem is that, as you can read in the topic, QMouseEvent::pos() has different values on different operating systems. I have created the simplest example possible. This example is based on the "Qt Widgets Application", provided in the "Create New" menu of Qt Creator.
In general, this is the window with red rectangle. This rectangle have 50 px margins from top, bottom, right al left. This value (I mean, 50) is definitely hardcoded and cannot be changed from the application.
The (0,0) point of the widget is located in the left-top corner. That means, that when I click on the left-top corner of the red rectangle (a little bit pixel hunting, but that's OK), I anticipate to click to the position with the coordinates of (50,50).
But, for a reason that I cannot understand:
- It is true on Windows only.
- On Linux I get (51, 51), a single pixel shift.
- On MacOS I get (52, 52), a two pixels shift.
Is that a known behavior? Or how could I fix it?
I am not attaching the sample code as text here (as I've done to the issues mentioned above), but just as a zip archive (see attachemnts).