QGIS/python/PyQt/PyQt5/QtCore.py

49 lines
1.0 KiB
Python
Raw Normal View History

from PyQt5.QtCore import *
2016-05-11 21:18:54 +02:00
from types import MethodType
2016-05-11 21:36:30 +02:00
_QVariant__repr__ = QVariant.__repr__
_QVariant__eq__ = QVariant.__eq__
_QVariant__ne__ = QVariant.__ne__
_QVariant__hash__ = QVariant.__hash__
2016-05-11 21:18:54 +02:00
def __bool__(self):
return not self.isNull()
2016-05-11 21:18:54 +02:00
def __repr__(self):
if self.isNull():
return 'NULL'
else:
2016-05-11 21:36:30 +02:00
return _QVariant__repr__(self)
2016-05-11 21:18:54 +02:00
def __eq__(self, other):
if self.isNull():
return (isinstance(other, QVariant) and other.isNull())or other is None
else:
2016-05-11 21:36:30 +02:00
return _QVariant__eq__(self, other)
2016-05-11 21:18:54 +02:00
def __ne__(self, other):
if self.isNull():
return not (isinstance(other, QVariant) and other.isNull()) and other is not None
else:
2016-05-11 21:36:30 +02:00
return _QVariant__ne__(self, other)
2016-05-11 21:18:54 +02:00
def __hash__(self):
if self.isNull():
return 2178309
else:
2016-05-11 21:36:30 +02:00
return _QVariant__hash__(self)
2016-05-11 21:18:54 +02:00
QVariant.__bool__ = __bool__
2016-05-11 21:18:54 +02:00
QVariant.__repr__ = __repr__
QVariant.__eq__ = __eq__
QVariant.__ne__ = __ne__
QVariant.__hash__ = __hash__
NULL = QVariant(QVariant.Int)