6767
6868def _setup_pyqt5 ():
6969 global QtCore , QtGui , QtWidgets , __version__ , is_pyqt5 , \
70- _isdeleted , _devicePixelRatio , _setDevicePixelRatio , _getSaveFileName
70+ _isdeleted , _getSaveFileName
7171
7272 if QT_API == QT_API_PYQT5 :
7373 from PyQt5 import QtCore , QtGui , QtWidgets
@@ -89,14 +89,10 @@ def _isdeleted(obj): return not shiboken2.isValid(obj)
8989 def is_pyqt5 ():
9090 return True
9191
92- # self.devicePixelRatio() returns 0 in rare cases
93- def _devicePixelRatio (obj ): return obj .devicePixelRatio () or 1
94- def _setDevicePixelRatio (obj , factor ): obj .setDevicePixelRatio (factor )
95-
9692
9793def _setup_pyqt4 ():
9894 global QtCore , QtGui , QtWidgets , __version__ , is_pyqt5 , \
99- _isdeleted , _devicePixelRatio , _setDevicePixelRatio , _getSaveFileName
95+ _isdeleted , _getSaveFileName
10096
10197 def _setup_pyqt4_internal (api ):
10298 global QtCore , QtGui , QtWidgets , \
@@ -149,9 +145,6 @@ def _isdeleted(obj): return not shiboken.isValid(obj)
149145 def is_pyqt5 ():
150146 return False
151147
152- def _devicePixelRatio (obj ): return 1
153- def _setDevicePixelRatio (obj , factor ): pass
154-
155148
156149if QT_API in [QT_API_PYQT5 , QT_API_PYSIDE2 ]:
157150 _setup_pyqt5 ()
@@ -220,6 +213,6 @@ def _setDevicePixelRatioF(obj, val):
220213 if hasattr (obj , 'setDevicePixelRatioF' ):
221214 # Not available on Qt<5.6
222215 obj .setDevicePixelRatioF (val )
223- if hasattr (obj , 'setDevicePixelRatio' ):
216+ elif hasattr (obj , 'setDevicePixelRatio' ):
224217 # Not available on Qt4 or some older Qt5.
225218 obj .setDevicePixelRatio (val )
0 commit comments