Skip to content

Commit

Permalink
compat.py: Add wrapper around sip/shiboken isdeleted/isvalid
Browse files Browse the repository at this point in the history
  • Loading branch information
zjp committed Jul 16, 2022
1 parent 9588c9c commit 0ea3461
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions qtpy/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
"""
import sys

from . import (
PYQT5,
PYQT6,
PYSIDE2,
PYSIDE6,
QtBindingsNotFoundError,
)

from .QtWidgets import QFileDialog


Expand Down Expand Up @@ -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()

0 comments on commit 0ea3461

Please sign in to comment.