Skip to content

Commit

Permalink
Refactor QwtColorMap to derive from QObject for better memory management
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRaybaut committed Jul 26, 2024
1 parent cbff786 commit d763d87
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions qwt/color_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
:members:
"""

from qtpy.QtCore import Qt, qIsNaN
from qtpy.QtCore import QObject, Qt, qIsNaN
from qtpy.QtGui import QColor, qAlpha, qBlue, qGreen, qRed, qRgb, qRgba


Expand Down Expand Up @@ -211,8 +211,10 @@ def colorIndex(self, interval, value):
return 0


class QwtLinearColorMap_PrivateData(object):
class QwtLinearColorMap_PrivateData(QObject):
def __init__(self):
QObject.__init__(self)

self.colorStops = ColorStops()
self.mode = None

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


class QwtAlphaColorMap_PrivateData(object):
class QwtAlphaColorMap_PrivateData(QObject):
def __init__(self):
QObject.__init__(self)

self.color = QColor()
self.rgb = QColor().rgb()
self.rgbMax = QColor().rgb()
Expand Down

0 comments on commit d763d87

Please sign in to comment.