diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 1122459..b645f5f 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -64,6 +64,12 @@ jobs: qt-api: "PyQt6" extra-system-packages: "glibc-tools" + - os: ubuntu-22.04 + python-version: "3.12" + test-env: "PySide6~=6.6.0" + qt-api: "PySide6" + extra-system-packages: "glibc-tools" + # macOS - os: macos-11 python-version: 3.7 @@ -101,6 +107,10 @@ jobs: python-version: "3.12" test-env: "PyQt6~=6.6.0 PyQt6-Qt6~=6.6.0" + - os: macos-11 + python-version: "3.12" + test-env: "PySide6~=6.6.0" + # Windows - os: windows-2019 python-version: 3.7 @@ -138,6 +148,10 @@ jobs: python-version: "3.12" test-env: "PyQt6~=6.6.0 PyQt6-Qt6~=6.6.0" + - os: windows-2019 + python-version: "3.12" + test-env: "PySide6~=6.6.0" + steps: - uses: actions/checkout@v4 - name: Setup Python diff --git a/AnyQt/QtCharts.py b/AnyQt/QtCharts.py index 5281e3f..4286a1d 100644 --- a/AnyQt/QtCharts.py +++ b/AnyQt/QtCharts.py @@ -12,5 +12,8 @@ from PySide2.QtCharts import * elif _api.USED_API == _api.QT_API_PYSIDE6: from PySide6.QtCharts import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtCore.py b/AnyQt/QtCore.py index 1b1b9ef..e3567b1 100644 --- a/AnyQt/QtCore.py +++ b/AnyQt/QtCore.py @@ -340,6 +340,13 @@ QT_VERSION = (_major << 16) + (_minor << 8) + _micro QT_VERSION_STR = "{}.{}.{}".format(_major, _minor, _micro) BoundSignal = Signal +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtCore import * + _major, _minor, _micro = tuple(map(int, qVersion().split(".")[:3])) + QT_VERSION = (_major << 16) + (_minor << 8) + _micro + QT_VERSION_STR = "{}.{}.{}".format(_major, _minor, _micro) + BoundSignal = Signal + PYQT_VERSION = 0x60000 # Missing in PyQt4 <= 4.11.3 if not hasattr(QEvent, "MacSizeChange"): @@ -423,11 +430,14 @@ def value(self, key, defaultValue=None, type=None): pyqtSlot = Slot pyqtProperty = Property -if _api.USED_API == _api.QT_API_PYSIDE2: - try: - from PySide2 import shiboken2 as __shiboken2 - except ImportError: - import shiboken2 as __shiboken2 +if _api.USED_API in (_api.QT_API_PYSIDE2, _api.QT_API_PYSIDE6): + if _api.USED_API == _api.QT_API_PYSIDE2: + try: + from PySide2 import shiboken2 as __shiboken2 + except ImportError: + import shiboken2 as __shiboken2 + else: + import shiboken6 as __shiboken2 def cast(obj, type_): addr = unwrapinstance(obj) diff --git a/AnyQt/QtDBus.py b/AnyQt/QtDBus.py index 446b32d..4900d3e 100644 --- a/AnyQt/QtDBus.py +++ b/AnyQt/QtDBus.py @@ -8,5 +8,12 @@ from PyQt4.QtDBus import * elif _api.USED_API == _api.QT_API_PYSIDE: from PySide.QtDBus import * +elif _api.USED_API == _api.QT_API_PYSIDE2: + from PySide2.QtDBus import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtDBus import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtDataVisualization.py b/AnyQt/QtDataVisualization.py index 9d48a83..2e53f05 100644 --- a/AnyQt/QtDataVisualization.py +++ b/AnyQt/QtDataVisualization.py @@ -12,5 +12,8 @@ from PySide2.QtDataVisualization import * elif _api.USED_API == _api.QT_API_PYSIDE6: from PySide6.QtDataVisualization import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtDesigner.py b/AnyQt/QtDesigner.py index d3b86c7..88be716 100644 --- a/AnyQt/QtDesigner.py +++ b/AnyQt/QtDesigner.py @@ -8,5 +8,12 @@ from PyQt4.QtDesigner import * elif _api.USED_API == _api.QT_API_PYSIDE: from PySide.QtDesigner import * +elif _api.USED_API == _api.QT_API_PYSIDE2: + from PySide2.QtDesigner import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtDesigner import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtGui.py b/AnyQt/QtGui.py index 111c7e6..acaea7d 100644 --- a/AnyQt/QtGui.py +++ b/AnyQt/QtGui.py @@ -268,6 +268,9 @@ def __init__(self, *args): from PySide2.QtGui import * from PySide2.QtWidgets import QUndoCommand, QUndoStack, QUndoGroup from PySide2.QtWidgets import QShortcut, QAction, QActionGroup +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtGui import * + if _api.USED_API in [_api.QT_API_PYQT4, _api.QT_API_PYSIDE]: from AnyQt import QtCore as __QtCore @@ -296,8 +299,11 @@ def __QWheelEvent_pixelDelta(self): QWheelEvent.angleDelta = __QWheelEvent_angleDelta QWheelEvent.pixelDelta = __QWheelEvent_pixelDelta -if _api.USED_API == _api.QT_API_PYSIDE2: - from PySide2.QtCore import QRectF as __QRectF +if _api.USED_API in (_api.QT_API_PYSIDE2, _api.QT_API_PYSIDE6): + if _api.USED_API == _api.QT_API_PYSIDE2: + from PySide2.QtCore import QRectF as __QRectF + else: + from PySide6.QtCore import QRectF as __QRectF _QPainter_drawPixmapFragments_orig = QPainter.drawPixmapFragments class __ArgsTypeError(TypeError): pass diff --git a/AnyQt/QtHelp.py b/AnyQt/QtHelp.py index c831c88..8c1f64f 100644 --- a/AnyQt/QtHelp.py +++ b/AnyQt/QtHelp.py @@ -10,5 +10,10 @@ from PySide.QtHelp import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtHelp import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtHelp import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtLocation.py b/AnyQt/QtLocation.py index 31a0597..13c52a6 100644 --- a/AnyQt/QtLocation.py +++ b/AnyQt/QtLocation.py @@ -12,5 +12,8 @@ from PySide2.QtLocation import * elif _api.USED_API == _api.QT_API_PYSIDE6: from PySide6.QtLocation import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtMacExtras.py b/AnyQt/QtMacExtras.py index 704a992..f659e06 100644 --- a/AnyQt/QtMacExtras.py +++ b/AnyQt/QtMacExtras.py @@ -12,5 +12,12 @@ from PyQt4.QtGui import QMacPasteboardMime elif _api.USED_API == _api.QT_API_PYSIDE: from PySide.QtGui import QMacPasteboardMime +elif _api.USED_API == _api.QT_API_PYSIDE2: + from PySide2.QtMacExtras import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtMacExtras import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtMultimedia.py b/AnyQt/QtMultimedia.py index aae7c32..077b90e 100644 --- a/AnyQt/QtMultimedia.py +++ b/AnyQt/QtMultimedia.py @@ -10,5 +10,10 @@ from PySide.QtMultimedia import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtMultimedia import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtMultimedia import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtMultimediaWidgets.py b/AnyQt/QtMultimediaWidgets.py index ee6d602..0ea3df8 100644 --- a/AnyQt/QtMultimediaWidgets.py +++ b/AnyQt/QtMultimediaWidgets.py @@ -6,8 +6,9 @@ from PyQt5.QtMultimediaWidgets import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtMultimediaWidgets import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtMultimediaWidgets import * else: - raise ImportError("No module named 'QtMultimediaWidgets' in the selected" - "Qt api ({})".format(_api.USED_API)) - + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtNetwork.py b/AnyQt/QtNetwork.py index 9e2af44..29799ce 100644 --- a/AnyQt/QtNetwork.py +++ b/AnyQt/QtNetwork.py @@ -56,5 +56,10 @@ from PySide.QtNetwork import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtNetwork import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtNetwork import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtNetworkAuth.py b/AnyQt/QtNetworkAuth.py index c4792de..2013bfd 100644 --- a/AnyQt/QtNetworkAuth.py +++ b/AnyQt/QtNetworkAuth.py @@ -12,5 +12,8 @@ from PySide2.QtNetworkAuth import * elif _api.USED_API == _api.QT_API_PYSIDE6: from PySide6.QtNetworkAuth import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtOpenGL.py b/AnyQt/QtOpenGL.py index 3f177e4..b39f0db 100644 --- a/AnyQt/QtOpenGL.py +++ b/AnyQt/QtOpenGL.py @@ -10,5 +10,9 @@ from PySide.QtOpenGL import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtOpenGL import * - +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtOpenGL import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtPdf.py b/AnyQt/QtPdf.py index 1a618f9..71b972b 100644 --- a/AnyQt/QtPdf.py +++ b/AnyQt/QtPdf.py @@ -12,5 +12,8 @@ from PySide2.QtPdf import * elif _api.USED_API == _api.QT_API_PYSIDE6: from PySide6.QtPdf import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtPdfWidgets.py b/AnyQt/QtPdfWidgets.py index be50309..bd0d126 100644 --- a/AnyQt/QtPdfWidgets.py +++ b/AnyQt/QtPdfWidgets.py @@ -12,5 +12,8 @@ from PySide2.QtPdfWidgets import * elif _api.USED_API == _api.QT_API_PYSIDE6: from PySide6.QtPdfWidgets import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtPositioning.py b/AnyQt/QtPositioning.py index 84e9cd6..2916e6f 100644 --- a/AnyQt/QtPositioning.py +++ b/AnyQt/QtPositioning.py @@ -12,5 +12,8 @@ from PySide2.QtPositioning import * elif _api.USED_API == _api.QT_API_PYSIDE6: from PySide6.QtPositioning import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtPrintSupport.py b/AnyQt/QtPrintSupport.py index 367128a..5939eb4 100644 --- a/AnyQt/QtPrintSupport.py +++ b/AnyQt/QtPrintSupport.py @@ -39,5 +39,10 @@ ) elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtPrintSupport import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtPrintSupport import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtQml.py b/AnyQt/QtQml.py index 1d017bb..9cacf30 100644 --- a/AnyQt/QtQml.py +++ b/AnyQt/QtQml.py @@ -6,8 +6,9 @@ from PyQt5.QtQml import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtQml import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtQml import * else: - raise ImportError("No module named 'QtQml' in the selected " - "Qt api ({})".format(_api.USED_API)) - + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtQuick.py b/AnyQt/QtQuick.py index ec2d1c7..435d135 100644 --- a/AnyQt/QtQuick.py +++ b/AnyQt/QtQuick.py @@ -6,8 +6,10 @@ from PyQt5.QtQuick import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtQuick import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtQuick import * else: - raise ImportError("No module named 'QtQuick' in the selected " - "Qt api ({})".format(_api.USED_API)) + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtRemoteObjects.py b/AnyQt/QtRemoteObjects.py index 2345b2f..d804fcd 100644 --- a/AnyQt/QtRemoteObjects.py +++ b/AnyQt/QtRemoteObjects.py @@ -12,5 +12,8 @@ from PySide2.QtRemoteObjects import * elif _api.USED_API == _api.QT_API_PYSIDE6: from PySide6.QtRemoteObjects import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtSql.py b/AnyQt/QtSql.py index 4bfec6b..d400481 100644 --- a/AnyQt/QtSql.py +++ b/AnyQt/QtSql.py @@ -10,5 +10,10 @@ from PySide.QtSql import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtSql import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtSql import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) \ No newline at end of file diff --git a/AnyQt/QtSvg.py b/AnyQt/QtSvg.py index 1668071..d02cb14 100644 --- a/AnyQt/QtSvg.py +++ b/AnyQt/QtSvg.py @@ -11,5 +11,11 @@ from PySide.QtSvg import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtSvg import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtSvg import * + from PySide6.QtSvgWidgets import QSvgWidget, QGraphicsSvgItem +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtSvgWidgets.py b/AnyQt/QtSvgWidgets.py index 2780b2c..75da0aa 100644 --- a/AnyQt/QtSvgWidgets.py +++ b/AnyQt/QtSvgWidgets.py @@ -10,5 +10,10 @@ from PySide.QtSvg import QSvgWidget, QGraphicsSvgItem elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtSvg import QSvgWidget, QGraphicsSvgItem +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtSvgWidgets import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtTest.py b/AnyQt/QtTest.py index 67acfb8..a0b16c5 100644 --- a/AnyQt/QtTest.py +++ b/AnyQt/QtTest.py @@ -10,6 +10,8 @@ from PySide.QtTest import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtTest import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtTest import * def _QTest_qSleep(ms: int): @@ -84,7 +86,8 @@ def _QTest_qWaitForWindowActive(widget, timeout=1000): QTest.qWaitForWindowActive = _QTest_qWaitForWindowActive -if _api.USED_API in {_api.QT_API_PYQT4, _api.QT_API_PYSIDE, _api.QT_API_PYSIDE2}: +if _api.USED_API in {_api.QT_API_PYQT4, _api.QT_API_PYSIDE, + _api.QT_API_PYSIDE2, _api.QT_API_PYSIDE6}: from AnyQt.QtCore import QObject, QByteArray as _QByteArray # not exposed in PyQt4 or PySide. Going by PyQt5 interface @@ -124,7 +127,7 @@ def wait(self, timeout=5000): self.__timer.stop() self.__timer.setInterval(timeout) self.__timer.start() - self.__loop.exec_() + self.__loop.exec() self.__timer.stop() return len(self) != count diff --git a/AnyQt/QtWebChannel.py b/AnyQt/QtWebChannel.py index a9e51e4..fe1fb81 100644 --- a/AnyQt/QtWebChannel.py +++ b/AnyQt/QtWebChannel.py @@ -5,6 +5,8 @@ from PyQt5.QtWebChannel import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtWebChannel import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtWebChannel import * else: raise ImportError("No module named 'QtWebChannel' in the selected " "Qt api ({})".format(_api.USED_API)) diff --git a/AnyQt/QtWebEngineCore.py b/AnyQt/QtWebEngineCore.py index 1f2b21c..678b8a2 100644 --- a/AnyQt/QtWebEngineCore.py +++ b/AnyQt/QtWebEngineCore.py @@ -16,8 +16,22 @@ ) except ImportError: pass - - +elif _api.USED_API == _api.QT_API_PYSIDE2: + from PySide2.QtWebEngineCore import * + try: + from PySide2.QtWebEngineWidgets import ( + QWebEngineHistory, + QWebEngineProfile, + QWebEngineScript, + QWebEngineScriptCollection, + # QWebEngineClientCertificateSelection, + QWebEngineSettings, + QWebEngineFullScreenRequest, + ) + except ImportError: + pass +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtWebEngineCore import * else: raise ImportError("No module named 'QtWebEngineCore' in the selected " "Qt api ({})".format(_api.USED_API)) diff --git a/AnyQt/QtWebEngineWidgets.py b/AnyQt/QtWebEngineWidgets.py index e802c51..980f625 100644 --- a/AnyQt/QtWebEngineWidgets.py +++ b/AnyQt/QtWebEngineWidgets.py @@ -15,6 +15,17 @@ from PyQt5.QtWebEngineWidgets import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtWebEngineWidgets import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtWebEngineWidgets import * + from PySide6.QtWebEngineCore import ( + QWebEngineHistory, + QWebEngineProfile, + QWebEngineScript, + QWebEngineScriptCollection, + # QWebEngineClientCertificateSelection, + QWebEngineSettings, + QWebEngineFullScreenRequest, + ) else: raise ImportError("No module named 'QtWebEngineWidgets' in the selected " "Qt api ({})".format(_api.USED_API)) diff --git a/AnyQt/QtWebKit.py b/AnyQt/QtWebKit.py index 7e2973e..cd0598b 100644 --- a/AnyQt/QtWebKit.py +++ b/AnyQt/QtWebKit.py @@ -55,3 +55,5 @@ pass elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtWebKit import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtWebKit import * diff --git a/AnyQt/QtWebKitWidgets.py b/AnyQt/QtWebKitWidgets.py index 319d0ed..e9c4497 100644 --- a/AnyQt/QtWebKitWidgets.py +++ b/AnyQt/QtWebKitWidgets.py @@ -32,5 +32,9 @@ QWebPage, QWebView, ) +elif _api.USED_API == _api.QT_API_PYSIDE2: + from PySide2.QtWebKitWidgets import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtWebKitWidgets import * _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtWebSockets.py b/AnyQt/QtWebSockets.py index a37db9d..9cb7063 100644 --- a/AnyQt/QtWebSockets.py +++ b/AnyQt/QtWebSockets.py @@ -6,6 +6,8 @@ from PyQt5.QtWebSockets import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtWebSockets import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtWebSockets import * else: raise ImportError("No module named 'QtWebSockets' in the selected " "Qt api ({})".format(_api.USED_API)) diff --git a/AnyQt/QtWidgets.py b/AnyQt/QtWidgets.py index 07fd7e9..1763d35 100644 --- a/AnyQt/QtWidgets.py +++ b/AnyQt/QtWidgets.py @@ -336,6 +336,11 @@ def _QWidget_grab(self, rect=__QtCore.QRect(0, 0, -1, -1)): elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtWidgets import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtWidgets import * + from PySide6.QtGui import QAction, QActionGroup + from PySide6.QtGui import QUndoCommand, QUndoStack, QUndoGroup + from PySide6.QtGui import QShortcut try: QWIDGETSIZE_MAX # Missing in older PyQt5, PyQt4 diff --git a/AnyQt/QtWinExtras.py b/AnyQt/QtWinExtras.py index a0cf4c4..0117d9d 100644 --- a/AnyQt/QtWinExtras.py +++ b/AnyQt/QtWinExtras.py @@ -6,8 +6,11 @@ from PyQt5.QtWinExtras import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtWinExtras import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtWinExtras import * else: - raise ImportError + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtX11Extras.py b/AnyQt/QtX11Extras.py index 7b8a4dc..7f08595 100644 --- a/AnyQt/QtX11Extras.py +++ b/AnyQt/QtX11Extras.py @@ -12,5 +12,10 @@ from PySide.QtGui import QX11Info elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtX11Extras import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtX11Extras import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtXml.py b/AnyQt/QtXml.py index 9c6a1f9..d320f05 100644 --- a/AnyQt/QtXml.py +++ b/AnyQt/QtXml.py @@ -10,5 +10,10 @@ from PySide.QtXml import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtXml import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtXml import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/QtXmlPatterns.py b/AnyQt/QtXmlPatterns.py index fc36ca1..2236f82 100644 --- a/AnyQt/QtXmlPatterns.py +++ b/AnyQt/QtXmlPatterns.py @@ -10,5 +10,10 @@ from PySide.QtXmlPatterns import * elif _api.USED_API == _api.QT_API_PYSIDE2: from PySide2.QtXmlPatterns import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + from PySide6.QtXmlPatterns import * +else: + raise ImportError(f"No module named '{__name__}' in the selected " + f"Qt api ({_api.USED_API})") _api.apply_global_fixes(globals()) diff --git a/AnyQt/_api.py b/AnyQt/_api.py index 356dec7..708047a 100644 --- a/AnyQt/_api.py +++ b/AnyQt/_api.py @@ -105,6 +105,8 @@ def comittoapi(api): __available = QT_API_PYSIDE2 elif "PyQt6" in available: __available = QT_API_PYQT6 + elif "PySide6" in available: + __available = QT_API_PYSIDE6 if __available is not None: comittoapi(__available) diff --git a/AnyQt/_fixes.py b/AnyQt/_fixes.py index 54b1e42..3737e9c 100644 --- a/AnyQt/_fixes.py +++ b/AnyQt/_fixes.py @@ -288,6 +288,9 @@ def QStandardItem_insertRow(self, row, items): fix_pyside_exec, fix_qstandarditem_insert_row, ], + "pyside6": [ + fix_qstandarditem_insert_row + ] } diff --git a/AnyQt/uic.py b/AnyQt/uic.py index 412fb97..8cc5452 100644 --- a/AnyQt/uic.py +++ b/AnyQt/uic.py @@ -10,3 +10,6 @@ elif _api.USED_API == _api.QT_API_PYSIDE2: # This will fail with an ImportError (as it should) from PySide2.uic import * +elif _api.USED_API == _api.QT_API_PYSIDE6: + # This will fail with an ImportError (as it should) + from PySide6.uic import * diff --git a/test/test_import.py b/test/test_import.py index 46a6d83..d10ba26 100644 --- a/test/test_import.py +++ b/test/test_import.py @@ -6,7 +6,8 @@ 'pyqt5': 'PyQt5', 'pyside': 'PySide', 'pyside2': 'PySide2', - 'pyqt6:': "PyQt6" + 'pyqt6:': "PyQt6", + 'pyside6': 'PySide6', } submodules_common = [ @@ -40,6 +41,7 @@ 'QtWebEngineCore', 'QtWebSockets', 'QtQml', + 'QtQuick', 'QtXmlPatterns', "QtLocation", ]