diff --git a/qtpy/compat.py b/qtpy/compat.py index 45e11338..3ca613d4 100644 --- a/qtpy/compat.py +++ b/qtpy/compat.py @@ -7,6 +7,14 @@ """ import sys +from . import ( + PYQT5, + PYQT6, + PYSIDE2, + PYSIDE6, + QtBindingsNotFoundError, +) + from .QtWidgets import QFileDialog @@ -129,3 +137,14 @@ def getsavefilename(parent=None, caption='', basedir='', filters='', caption=caption, basedir=basedir, filters=filters, selectedfilter=selectedfilter, options=options) + +# ============================================================================= +def isalive(object): + if PYQT5 or PYQT6: + from . import sip + return sip.isdeleted(object) + elif PYSIDE2 or PYSIDE6: + from . import shiboken + return shiboken.isValid(object) + else: + raise QtBindingsNotFoundError()