Skip to content

BUG: Fix high DPI display on windows with multiple screens

Created by: vovythevov

The issue arises when displaying Slicer on multiple high dpi screens. A transparent bar is displayed below the toolbar and shifts the whole rendering. This comes from the Qt windows display plugin (QPA layer) that sets the windows dpi awarness to PROCESS_PER_MONITOR_DPI_AWARE by default. Although it is the appropriate value, Qt doesn't handle it properly. Unfortunately, there is no API to call to change the ProcessDPIAwarness value. We can however directly call the windows method SetProcessDPIAware() that will superseed the Qt call and set the ProcessDPIAwarness to PROCESS_SYSTEM_DPI_AWARE instead which solves the issue.

For reference: http://doc.qt.io/qt-5/qpa.html https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx

For illustration: Without the fix on a mirrored display: highdpi_bug

With the fix: highdpi_fixed

The issue in a gif. On the left is one screen and on the right the other: highdpi_issue_gif

Merge request reports