File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ def paintEvent(self, event):
61
61
62
62
if QT_API == "PyQt6" :
63
63
from PyQt6 import sip
64
- ptr = sip .voidptr (buf )
64
+ ptr = int ( sip .voidptr (buf ) )
65
65
else :
66
66
ptr = buf
67
67
qimage = QtGui .QImage (
@@ -74,7 +74,8 @@ def paintEvent(self, event):
74
74
# Adjust the buf reference count to work around a memory
75
75
# leak bug in QImage under PySide.
76
76
if QT_API in ('PySide' , 'PySide2' ):
77
- ctypes .c_long .from_address (id (buf )).value = 1
77
+ if QtCore .__version_info__ < (5 , 12 ):
78
+ ctypes .c_long .from_address (id (buf )).value = 1
78
79
79
80
self ._draw_rect_callback (painter )
80
81
finally :
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ def paintEvent(self, event):
29
29
buf = self ._renderer .gc .ctx .get_target ().get_data ()
30
30
if QT_API == "PyQt6" :
31
31
from PyQt6 import sip
32
- ptr = sip .voidptr (buf )
32
+ ptr = int ( sip .voidptr (buf ) )
33
33
else :
34
34
ptr = buf
35
35
qimage = QtGui .QImage (
@@ -38,7 +38,8 @@ def paintEvent(self, event):
38
38
# Adjust the buf reference count to work around a memory leak bug in
39
39
# QImage under PySide.
40
40
if QT_API in ('PySide' , 'PySide2' ):
41
- ctypes .c_long .from_address (id (buf )).value = 1
41
+ if QtCore .__version_info__ < (5 , 12 ):
42
+ ctypes .c_long .from_address (id (buf )).value = 1
42
43
_setDevicePixelRatio (qimage , self .device_pixel_ratio )
43
44
painter = QtGui .QPainter (self )
44
45
painter .eraseRect (event .rect ())
You can’t perform that action at this time.
0 commit comments