Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.11.1, 5.13.2
-
None
-
Windows 10. Bug occurs with both vs2015 and vs2019.
Description
We do OpenGL drawing in a widget that inherits from GLWidget, which is in a MainWindow. However, when the window starts on my second monitor, the mouse position in QMouseEvent in mousePressEvent is incorrect (offset vertically by an amount like 30 pixels).
Also if glViewport() is called in resizeGL(), the rendering is done in the wrong position.
To replicate:
- Open the attached program (opengl_test.cpp).
- Adjust the position the window opens at, with main_window.setGeometry(), so that it opens on your second monitor.
- Run the program.
- Click on the upper left pixel of the GL widget.
- Expected Result:
TestGLWidget::mousePressEvent():
e->pos(): 0, 0
e->localPos(): 0, 0 - Actual (incorrect) result:
TestGLWidget::mousePressEvent():
e->pos(): 8, 31
e->localPos(): 8, 31
In addition, the red quad will be drawn in an incorrect position where it doesn't cover the entire widget.
This is a serious bug for us, because it makes the glwidget useless when opened on the second monitor, since we can't do mouse picking correctly, due to the offset.