Closed ovo-Tim closed 1 year ago
Though I don't have a solution for you, it might be a good idea to look into the occt / qopenglwidget example: https://github.com/gkv311/occt-samples-qopenglwidget
I think we might be able to replicate the code with python and pythonocc.
This code basically move the OpenGl context management to qt. OCCT simply renderes into the context created by qt. This does not need to call winId
, since the OpenGl context is already created.
https://github.com/gkv311/occt-samples-qopenglwidget I found that still can't work on wayland.https://github.com/gkv311/occt-samples-qopenglwidget/issues/15
I have a idea, it's not final solution, but it can work.
if platform.system() == 'Linux':
if os.popen('echo $XDG_SESSION_TYPE').read() == 'wayland\n':
os.environ['QT_QPA_PLATFORM'] = 'xcb'
I have been trying to move up to Qt6 (PyQt6 and PySide6), and face, of course, the same issue. The 'QT_QPA_PLATFORM' trick does not work on my linux machine using PyQt6 installed from pip
.
1255 fixes the issue
I don't think that is the final solution. We should native support for the wayland instad of using xcb.
I think we should rewrite Display3d.cpp, we may need Display3d-qt.cpp
. But converting between different languages makes that difficult.
@ovo-Tim You're right, a specific linux tweak is required for this specific case, any contribution will be welcome.
Though I don't have a solution for you, it might be a good idea to look into the occt / qopenglwidget example: https://github.com/gkv311/occt-samples-qopenglwidget
I think we might be able to replicate the code with python and pythonocc.
This code basically move the OpenGl context management to qt. OCCT simply renderes into the context created by qt. This does not need to call
winId
, since the OpenGl context is already created.
@tpaviot I have no idea about how to realize it. But I think @rainman110 's advice is useful.
@rainman110 Hi, have you made any progress? 😘
I guess the key is here: https://github.com/gkv311/occt-samples-qopenglwidget/blob/master/occt-qopenglwidget/OcctQtViewer.cpp#L375
I think so. But I found that it still can't work on wayland. https://github.com/gkv311/occt-samples-qopenglwidget/issues/15
One more thing, I found there is a blog that talks about wayland
However, supporting Wayland in OCCT requires further research and modifying OCCT source code. Unfortunately, there is not much of the Linux community showing an interest in providing Wayland compatibility patches to OCCT – so that this task remains a low priority feature with XWayland as a working fallback.
OK, I have posted about this problem. https://dev.opencascade.org/content/it-possible-native-support-wayland#comment-25077 https://tracker.dev.opencascade.org/view.php?id=33505
It shouldn't be closed.
When I use
qtViewer3d
on wayland:That's because
QWidget.winId()
can't return right winID on Wayland, more information: https://forum.qt.io/post/764182 So, is there any other way to display on qt?