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

Qt5 import issue compared with Qt, PyQt or Pyside #8

Open
hannesdelbeke opened this issue Jul 1, 2022 · 2 comments
Open

Qt5 import issue compared with Qt, PyQt or Pyside #8

hannesdelbeke opened this issue Jul 1, 2022 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@hannesdelbeke
Copy link

the old Qt module can easily subsitute Pyside2
but when trying that with the new Qt5 it has to be done in a specific way.

it doesn't allow us to do this

from PySide2.QtWidgets import QApplication
from Qt.QtWidgets import QApplication
from Qt5.QtWidgets import QApplication  # errors
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
ModuleNotFoundError: No module named 'Qt5.QtWidgets'; 'Qt5' is not a package

This is fine

import PySide2
import Qt
import Qt5

This is fine

from PySide2 import QtWidgets
from Qt import QtWidgets
from Qt5 import QtWidgets
@hannesdelbeke
Copy link
Author

which means it's more work to change existing scripts to use Qt5.

example

instead of simply copy pasting Qt5 over PySide2, like this

from Qt5.QtWidgets import QApplication, QWidget
from Qt5.QtGui import QCloseEvent, QIcon, QImage, QPixmap, QWindow
from Qt5.QtCore import QEvent, QObject, QRect, QSettings

I need to do this:

import Qt5
QApplication = Qt5.QtWidgets.QApplication
QWidget = Qt5.QtWidgets.QWidget
QCloseEvent = Qt5.QtGui.QCloseEvent
QIcon = Qt5.QtGui.QIcon
QImage = Qt5.QtGui.QImage
QPixmap = Qt5.QtGui.QPixmap
QWindow = Qt5.QtGui.QWindow
QEvent = Qt5.QtCore.QEvent
QObject = Qt5.QtCore.QObject
QRect = Qt5.QtCore.QRect
QSettings = Qt5.QtCore.QSettings

@mottosso
Copy link
Owner

Thanks, a PR is very welcome.

@mottosso mottosso added the help wanted Extra attention is needed label Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants