Skip to content

Fix ScreenSize setting when using Qt on HiDPI display

Andras Lasso requested to merge lassoan/vtk:fix-qt-hdpi-screen-size into master

Qt uses device-independent coordinates and QVTK* classes convert those to actual device coordinates by multiplying by devicePixelRatio.

This conversion was missed when vtkRenderWindow::ScreenSize was set. As a result, on HiDPI screens, 1/2 or 1/3 of the actual screen pixel size was reported. If an application computed widget size relative to the screen size, the widget appeared 1/2 or 1/3 of the intended size.

Fixed by scaling device-independent size by devicePixelRatio, as it is done everywhere else in Qt->VTK adapter classes.

Merge request reports