Alex Luya
Alex Luya

Reputation: 9922

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

my configuration like this:

  Ubuntu 24.04
  OCC 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 this:

messed up UI

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 here

https://dev.opencascade.org/system/files/forum/occqt.zip

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?

Upvotes: 0

Views: 64

Answers (1)

Alex Luya
Alex Luya

Reputation: 9922

After upgrading to Qt 6.5.3, this problem gone

Upvotes: 0

Related Questions