Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to approach PySide2 and PySide6 only modules such as QtWebEngineWidgets #425

Closed
claudio-alvaro-wbgames opened this issue Nov 20, 2024 · 2 comments

Comments

@claudio-alvaro-wbgames
Copy link

While testing the PySide2/PySide6 binding, I get an assertion when importing newer modules, such as:

from Qt import QtWebEngineWidgets

I understand that the goal is to provide backwards compatibility for PySide/PyQt4, but these modules should simply assert within a PySide/PyQt4 binding as opposed to fail on their respective (remapped) binding. As a side-note, I noticed that Qt-stubs companion module includes most of the new modules.

Is this a bug or oversight? If not, what is the proposed approach to handling newer Qt modules?

I'm using Python 3.10 and Qt.py v1.41, alternating between PySide6 and PySide2.

@mottosso
Copy link
Owner

Is this a bug or oversight?

Are those the only options? 😊

The goal and intent of only including the cross section of Qt 4, 5 and 6 is to remain confident that if your project runs on one binding, it runs on them all.

The way to handle modules that are not supported by Qt 4, 5 and 6 is to explicitly include them, such that it is clear to the reader and writer where and how the project can run.

import Qt.py  # Support for every binding

# Extra features for clients with PySide6
try:
  from PySide6 import QtWebEngineWidgets
  with_web_widgets = True
except ImportError:
  with_web_widgets = False

There is an ongoing discussion about whether to remove the Qt 4 constraint, which would open up for more modules. Do add your voice there.

@claudio-alvaro-wbgames
Copy link
Author

Thanks for the snippet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants