[PYTHON] [VTK-8.2.0] QVTKRenderWindowInteractor crashes on a Remote Desktop
Running QVTKRenderWindowInteractor on a remote desktop (through RDP) raise a Qt TypeError exception
A simple fix can be:
QApplication.instance().devicePixelRatio()
instead of
QApplication.devicePixelRatio()
In _getPixelRatio
method of QVTKRenderWindowInteractor
@staticmethod
def _getPixelRatio():
if PyQtImpl in ["PyQt5", "PySide2"]:
# Source: https://stackoverflow.com/a/40053864/3388962
pos = QCursor.pos()
for screen in QApplication.screens():
rect = screen.geometry()
if rect.contains(pos):
return screen.devicePixelRatio()
# Should never happen, but try to find a good fallback.
return QApplication.devicePixelRatio()
else:
# Qt4 seems not to provide any cross-platform means to get the
# pixel ratio.
return 1.