Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/matplotlib/backends/backend_qtagg.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def paintEvent(self, event):

if QT_API == "PyQt6":
from PyQt6 import sip
ptr = sip.voidptr(buf)
ptr = int(sip.voidptr(buf))
else:
ptr = buf
qimage = QtGui.QImage(
Expand All @@ -74,7 +74,8 @@ def paintEvent(self, event):
# Adjust the buf reference count to work around a memory
# leak bug in QImage under PySide.
if QT_API in ('PySide', 'PySide2'):
ctypes.c_long.from_address(id(buf)).value = 1
if QtCore.__version_info__ < (5, 12):
ctypes.c_long.from_address(id(buf)).value = 1

self._draw_rect_callback(painter)
finally:
Expand Down
5 changes: 3 additions & 2 deletions lib/matplotlib/backends/backend_qtcairo.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def paintEvent(self, event):
buf = self._renderer.gc.ctx.get_target().get_data()
if QT_API == "PyQt6":
from PyQt6 import sip
ptr = sip.voidptr(buf)
ptr = int(sip.voidptr(buf))
else:
ptr = buf
qimage = QtGui.QImage(
Expand All @@ -38,7 +38,8 @@ def paintEvent(self, event):
# Adjust the buf reference count to work around a memory leak bug in
# QImage under PySide.
if QT_API in ('PySide', 'PySide2'):
ctypes.c_long.from_address(id(buf)).value = 1
if QtCore.__version_info__ < (5, 12):
ctypes.c_long.from_address(id(buf)).value = 1
_setDevicePixelRatio(qimage, self.device_pixel_ratio)
painter = QtGui.QPainter(self)
painter.eraseRect(event.rect())
Expand Down