HiDPI cursors: Support Qt < 5

Forum thread: https://forum.freecadweb.org/viewtopic.php?p=433621#p433621
This commit is contained in:
John Yani
2020-09-29 10:56:02 +03:00
committed by Yorik van Havre
parent 9d3e1b764d
commit 826f6c1bf3

View File

@@ -1122,7 +1122,8 @@ class Snapper:
mw = Gui.getMainWindow()
for w in mw.findChild(QtGui.QMdiArea).findChildren(QtGui.QWidget):
if w.metaObject().className() == "SIM::Coin3D::Quarter::QuarterWidget":
device_pixel_ratio = w.devicePixelRatio()
if int(QtCore.qVersion()) > 4:
device_pixel_ratio = w.devicePixelRatio()
return device_pixel_ratio
def get_cursor_with_tail(self, base_icon_name, tail_icon_name=None):
@@ -1146,7 +1147,8 @@ class Snapper:
qp.end()
cur_hot_x = 0.25 * full_icon_size * device_pixel_ratio
cur_hot_y = 0.25 * full_icon_size * device_pixel_ratio
new_icon.setDevicePixelRatio(device_pixel_ratio)
if int(QtCore.qVersion()) > 4:
new_icon.setDevicePixelRatio(device_pixel_ratio)
cur = QtGui.QCursor(new_icon, cur_hot_x, cur_hot_y)
return cur