Coverage for C:\Program Files\QGIS 3.10\apps\qgis-ltr\python\qgis\PyQt\QtCore.py: 62%
34 statements
« prev ^ index » next coverage.py v7.2.3, created at 2023-04-10 14:40 +0900
« prev ^ index » next coverage.py v7.2.3, created at 2023-04-10 14:40 +0900
1# -*- coding: utf-8 -*-
3"""
4***************************************************************************
5 QtCore.py
6 ---------------------
7 Date : November 2015
8 Copyright : (C) 2015 by Matthias Kuhn
9 Email : matthias at opengis dot ch
10***************************************************************************
11* *
12* This program is free software; you can redistribute it and/or modify *
13* it under the terms of the GNU General Public License as published by *
14* the Free Software Foundation; either version 2 of the License, or *
15* (at your option) any later version. *
16* *
17***************************************************************************
18"""
20__author__ = 'Matthias Kuhn'
21__date__ = 'November 2015'
22__copyright__ = '(C) 2015, Matthias Kuhn'
24from PyQt5.QtCore import *
26from types import MethodType
29_QVariant__repr__ = QVariant.__repr__
30_QVariant__eq__ = QVariant.__eq__
31_QVariant__ne__ = QVariant.__ne__
32_QVariant__hash__ = QVariant.__hash__
35def __bool__(self):
36 return not self.isNull()
39def __repr__(self):
40 if self.isNull():
41 return 'NULL'
42 else:
43 return _QVariant__repr__(self)
46def __eq__(self, other):
47 if self.isNull():
48 return (isinstance(other, QVariant) and other.isNull())or other is None
49 else:
50 return _QVariant__eq__(self, other)
53def __ne__(self, other):
54 if self.isNull():
55 return not (isinstance(other, QVariant) and other.isNull()) and other is not None
56 else:
57 return _QVariant__ne__(self, other)
60def __hash__(self):
61 if self.isNull():
62 return 2178309
63 else:
64 return _QVariant__hash__(self)
67QVariant.__bool__ = __bool__
68QVariant.__repr__ = __repr__
69QVariant.__eq__ = __eq__
70QVariant.__ne__ = __ne__
71QVariant.__hash__ = __hash__
73NULL = QVariant(QVariant.Int)