Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-85674

mousePressEvent mouse position and drawing is in wrong place for GLWidget created on second monitor

XMLWordPrintable

    • Windows

      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.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            lagocs Laszlo Agocs
            NChapman Nicholas Chapman
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes