Skip to content

Commit

Permalink
Add PySide6 and shiboken6 support to helper functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-chatterjee committed Feb 26, 2024
1 parent 95e6533 commit 59aaf91
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,12 +738,14 @@ def messageOutputHandler(*args):
passObject = messageOutputHandler if handler else handler
if Qt.IsPySide or Qt.IsPyQt4:
return Qt._QtCore.qInstallMsgHandler(passObject)
elif Qt.IsPySide2 or Qt.IsPyQt5:
elif Qt.IsPySide2 or Qt.IsPyQt5 or Qt.IsPySide6:
return Qt._QtCore.qInstallMessageHandler(passObject)


def _getcpppointer(object):
if hasattr(Qt, "_shiboken2"):
if hasattr(Qt, "_shiboken6"):
return getattr(Qt, "_shiboken6").getCppPointer(object)[0]
elif hasattr(Qt, "_shiboken2"):
return getattr(Qt, "_shiboken2").getCppPointer(object)[0]
elif hasattr(Qt, "_shiboken"):
return getattr(Qt, "_shiboken").getCppPointer(object)[0]
Expand Down Expand Up @@ -781,6 +783,8 @@ def _wrapinstance(ptr, base=None):
func = getattr(Qt, "_sip").wrapinstance
elif Qt.IsPySide2:
func = getattr(Qt, "_shiboken2").wrapInstance
elif Qt.IsPySide6:
func = getattr(Qt, "_shiboken6").wrapInstance
elif Qt.IsPySide:
func = getattr(Qt, "_shiboken").wrapInstance
else:
Expand Down Expand Up @@ -820,7 +824,10 @@ def _isvalid(object):
object (QObject): QObject to check the validity of.
"""
if hasattr(Qt, "_shiboken2"):
if hasattr(Qt, "_shiboken6"):
return getattr(Qt, "_shiboken6").isValid(object)

elif hasattr(Qt, "_shiboken2"):
return getattr(Qt, "_shiboken2").isValid(object)

elif hasattr(Qt, "_shiboken"):
Expand Down Expand Up @@ -1968,6 +1975,7 @@ def _install():
_install()

# Setup Binding Enum states
Qt.IsPySide6 = Qt.__binding__ == "PySide6"
Qt.IsPySide2 = Qt.__binding__ == 'PySide2'
Qt.IsPyQt5 = Qt.__binding__ == 'PyQt5'
Qt.IsPySide = Qt.__binding__ == 'PySide'
Expand Down

0 comments on commit 59aaf91

Please sign in to comment.