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

UI Error: QOpenGLContext::makeCurrent() called with non-opengl surface after upgrading to QT 6

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • None
    • 6.4.2
    • GUI: OpenGL
    • None
    • Linux/X11

    Description

      my configuration like this:

            Ubuntu 24.04
            OpenCassCAD 7.8.1
            QT 6.4.2 

      I have a QWindow which contains a QTabWidget, and this TabWidget has two children widgets

            First tab simply associates with a QPushButton
            Second tab associates with an OccQtViewer 

      The OccQtViewer is inherited from QOpenGLWidget, and contains all OCC related stuffs like in attached picture

      After switching from first tab to second tab, the UI get messed up and the tabs won't response to Clicking anymore and at the same time, below warning messages got printed out:

            QOpenGLContext::makeCurrent() called with non-opengl surface 0x5c468b22deb0
            QRhiGles2: Failed to make context current. Expect bad things to happen.
            QOpenGLContext::makeCurrent() called with non-opengl surface 0x5c468b22deb0
            QRhiGles2: Failed to make context current. Expect bad things to happen.
            QOpenGLContext::makeCurrent() called with non-opengl surface 0x5c468b22deb0
            QRhiGles2: Failed to make context current. Expect bad things to happen.
            ...

      And I have attached all related source code and 

          Under Windows, same code works fine with Qt_6 
          Under linux, it works fine with Qt_5, but with Qt_6, it will print out above warnings.
       
      I found a similar issue got reported here:

            https://github.com/MythTV/mythtv/issues/754

      And tried the suggestion inside it to setSurfaceType like this:

            QWidget* native = nativeParentWidget();
            windowHandle()->setSurfaceType(QWindow::OpenGLSurface);
            if (native && native->windowHandle())
                  native->windowHandle()->setSurfaceType(QWindow::OpenGLSurface);

      No lucky, this may be compatibility problem,
      but  I am not sure whether this problem comes from OCC or QT_6(under linux),

          Would you please help to fix this issue?

        [1]: https://i.sstatic.net/WxT4dq1w.png

      Attachments

        1. occqt.zip
          15 kB
        2. messed_up_ui.png
          messed_up_ui.png
          61 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            lagocs Laszlo Agocs
            alex_luya Alex Luya
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes