diff --git a/NodeGraphQt/vendor/Qt.py b/NodeGraphQt/vendor/Qt.py old mode 100644 new mode 100755 index b47ef631..b1d51c4f --- a/NodeGraphQt/vendor/Qt.py +++ b/NodeGraphQt/vendor/Qt.py @@ -44,7 +44,7 @@ import importlib -__version__ = "1.2.0.b3" +__version__ = "1.2.0" # Enable support for `from Qt import *` __all__ = [] @@ -778,6 +778,32 @@ def _wrapinstance(ptr, base=None): return func(long(ptr), base) +def _isvalid(object): + """Check if the object is valid to use in Python runtime. + + Usage: + See :func:`QtCompat.isValid()` + + Arguments: + object (QObject): QObject to check the validity of. + + """ + + assert isinstance(object, Qt.QtCore.QObject) + + if hasattr(Qt, "_shiboken2"): + return getattr(Qt, "_shiboken2").isValid(object) + + elif hasattr(Qt, "_shiboken"): + return getattr(Qt, "_shiboken").isValid(object) + + elif hasattr(Qt, "_sip"): + return not getattr(Qt, "_sip").isdeleted(object) + + else: + raise AttributeError("'module' has no attribute isValid") + + def _translate(context, sourceText, *args): # In Qt4 bindings, translate can be passed 2 or 3 arguments # In Qt5 bindings, translate can be passed 2 arguments @@ -968,6 +994,7 @@ def createWidget(self, class_name, parent=None, name=""): "QtUiTools.QUiLoader": ["QtCompat.loadUi", _loadUi], "shiboken2.wrapInstance": ["QtCompat.wrapInstance", _wrapinstance], "shiboken2.getCppPointer": ["QtCompat.getCppPointer", _getcpppointer], + "shiboken2.isValid": ["QtCompat.isValid", _isvalid], "QtWidgets.qApp": "QtWidgets.QApplication.instance()", "QtCore.QCoreApplication.translate": [ "QtCompat.translate", _translate @@ -992,6 +1019,7 @@ def createWidget(self, class_name, parent=None, name=""): "uic.loadUi": ["QtCompat.loadUi", _loadUi], "sip.wrapinstance": ["QtCompat.wrapInstance", _wrapinstance], "sip.unwrapinstance": ["QtCompat.getCppPointer", _getcpppointer], + "sip.isdeleted": ["QtCompat.isValid", _isvalid], "QtWidgets.qApp": "QtWidgets.QApplication.instance()", "QtCore.QCoreApplication.translate": [ "QtCompat.translate", _translate @@ -1024,6 +1052,7 @@ def createWidget(self, class_name, parent=None, name=""): "QtUiTools.QUiLoader": ["QtCompat.loadUi", _loadUi], "shiboken.wrapInstance": ["QtCompat.wrapInstance", _wrapinstance], "shiboken.unwrapInstance": ["QtCompat.getCppPointer", _getcpppointer], + "shiboken.isValid": ["QtCompat.isValid", _isvalid], "QtGui.qApp": "QtWidgets.QApplication.instance()", "QtCore.QCoreApplication.translate": [ "QtCompat.translate", _translate @@ -1057,6 +1086,7 @@ def createWidget(self, class_name, parent=None, name=""): "uic.loadUi": ["QtCompat.loadUi", _loadUi], "sip.wrapinstance": ["QtCompat.wrapInstance", _wrapinstance], "sip.unwrapinstance": ["QtCompat.getCppPointer", _getcpppointer], + "sip.isdeleted": ["QtCompat.isValid", _isvalid], "QtCore.QString": "str", "QtGui.qApp": "QtWidgets.QApplication.instance()", "QtCore.QCoreApplication.translate": [ @@ -1391,6 +1421,10 @@ def _pyside2(): if hasattr(Qt, "_QtCore"): Qt.__qt_version__ = Qt._QtCore.qVersion() + Qt.QtCompat.dataChanged = ( + lambda self, topleft, bottomright, roles=None: + self.dataChanged.emit(topleft, bottomright, roles or []) + ) if hasattr(Qt, "_QtWidgets"): Qt.QtCompat.setSectionResizeMode = \ @@ -1438,6 +1472,10 @@ def _pyside(): if hasattr(Qt, "_QtCore"): Qt.__qt_version__ = Qt._QtCore.qVersion() + Qt.QtCompat.dataChanged = ( + lambda self, topleft, bottomright, roles=None: + self.dataChanged.emit(topleft, bottomright) + ) _reassign_misplaced_members("PySide") _build_compatibility_members("PySide") @@ -1448,11 +1486,18 @@ def _pyqt5(): import PyQt5 as module extras = ["uic"] + try: import sip - extras.append(sip.__name__) + extras += ["sip"] except ImportError: - sip = None + + # Relevant to PyQt5 5.11 and above + try: + from PyQt5 import sip + extras += ["sip"] + except ImportError: + sip = None _setup(module, extras) if hasattr(Qt, "_sip"): @@ -1466,6 +1511,10 @@ def _pyqt5(): if hasattr(Qt, "_QtCore"): Qt.__binding_version__ = Qt._QtCore.PYQT_VERSION_STR Qt.__qt_version__ = Qt._QtCore.QT_VERSION_STR + Qt.QtCompat.dataChanged = ( + lambda self, topleft, bottomright, roles=None: + self.dataChanged.emit(topleft, bottomright, roles or []) + ) if hasattr(Qt, "_QtWidgets"): Qt.QtCompat.setSectionResizeMode = \ @@ -1542,6 +1591,10 @@ def _pyqt4(): if hasattr(Qt, "_QtCore"): Qt.__binding_version__ = Qt._QtCore.PYQT_VERSION_STR Qt.__qt_version__ = Qt._QtCore.QT_VERSION_STR + Qt.QtCompat.dataChanged = ( + lambda self, topleft, bottomright, roles=None: + self.dataChanged.emit(topleft, bottomright) + ) _reassign_misplaced_members("PyQt4") @@ -1867,4 +1920,4 @@ def _install(): # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.