File: QtCore.py

package info (click to toggle)
qgis 2.18.28%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,007,948 kB
  • sloc: cpp: 671,774; python: 158,539; xml: 35,690; ansic: 8,346; sh: 1,766; perl: 1,669; sql: 999; yacc: 836; lex: 461; makefile: 292
file content (48 lines) | stat: -rw-r--r-- 1,029 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from PyQt5.QtCore import *

from types import MethodType

_QVariant__repr__ = QVariant.__repr__
_QVariant__eq__ = QVariant.__eq__
_QVariant__ne__ = QVariant.__ne__
_QVariant__hash__ = QVariant.__hash__


def __bool__(self):
    return not self.isNull()


def __repr__(self):
    if self.isNull():
        return 'NULL'
    else:
        return _QVariant__repr__(self)


def __eq__(self, other):
    if self.isNull():
        return (isinstance(other, QVariant) and other.isNull())or other is None
    else:
        return _QVariant__eq__(self, other)


def __ne__(self, other):
    if self.isNull():
        return not (isinstance(other, QVariant) and other.isNull()) and other is not None
    else:
        return _QVariant__ne__(self, other)


def __hash__(self):
    if self.isNull():
        return 2178309
    else:
        return _QVariant__hash__(self)

QVariant.__bool__ = __bool__
QVariant.__repr__ = __repr__
QVariant.__eq__ = __eq__
QVariant.__ne__ = __ne__
QVariant.__hash__ = __hash__

NULL = QVariant(QVariant.Int)