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):
6161
6262 if QT_API == "PyQt6" :
6363 from PyQt6 import sip
64- ptr = sip .voidptr (buf )
64+ ptr = int ( sip .voidptr (buf ) )
6565 else :
6666 ptr = buf
6767 qimage = QtGui .QImage (
@@ -74,7 +74,8 @@ def paintEvent(self, event):
7474 # Adjust the buf reference count to work around a memory
7575 # leak bug in QImage under PySide.
7676 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
7879
7980 self ._draw_rect_callback (painter )
8081 finally :
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ def paintEvent(self, event):
2929 buf = self ._renderer .gc .ctx .get_target ().get_data ()
3030 if QT_API == "PyQt6" :
3131 from PyQt6 import sip
32- ptr = sip .voidptr (buf )
32+ ptr = int ( sip .voidptr (buf ) )
3333 else :
3434 ptr = buf
3535 qimage = QtGui .QImage (
@@ -38,7 +38,8 @@ def paintEvent(self, event):
3838 # Adjust the buf reference count to work around a memory leak bug in
3939 # QImage under PySide.
4040 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
4243 _setDevicePixelRatio (qimage , self .device_pixel_ratio )
4344 painter = QtGui .QPainter (self )
4445 painter .eraseRect (event .rect ())
You can’t perform that action at this time.
0 commit comments