Skip to content

Commit d763d87

Browse files
committed
Refactor QwtColorMap to derive from QObject for better memory management
1 parent cbff786 commit d763d87

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

qwt/color_map.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
:members:
2929
"""
3030

31-
from qtpy.QtCore import Qt, qIsNaN
31+
from qtpy.QtCore import QObject, Qt, qIsNaN
3232
from qtpy.QtGui import QColor, qAlpha, qBlue, qGreen, qRed, qRgb, qRgba
3333

3434

@@ -211,8 +211,10 @@ def colorIndex(self, interval, value):
211211
return 0
212212

213213

214-
class QwtLinearColorMap_PrivateData(object):
214+
class QwtLinearColorMap_PrivateData(QObject):
215215
def __init__(self):
216+
QObject.__init__(self)
217+
216218
self.colorStops = ColorStops()
217219
self.mode = None
218220

@@ -322,8 +324,10 @@ def colorIndex(self, interval, value):
322324
return int(ratio * 255 + 0.5)
323325

324326

325-
class QwtAlphaColorMap_PrivateData(object):
327+
class QwtAlphaColorMap_PrivateData(QObject):
326328
def __init__(self):
329+
QObject.__init__(self)
330+
327331
self.color = QColor()
328332
self.rgb = QColor().rgb()
329333
self.rgbMax = QColor().rgb()

0 commit comments

Comments
 (0)