Skip to content

Make the scrollbar slider width proportionate to the font DPI

Ahmad Samir requested to merge work/ahmad/scrollbar-width into master

On a system without Hi-DPI scaling:

  • with font DPI set to 192, the slider width will be 12 (6 * (192/96))
  • with font DPI set to 92, the slider width is the hardcoded 6

On a system with Hi-DPI scaling, it looks like QFontMetrics::fontDpi() returns 96 (even if the DPI is set to 192 in the fonts KCM), so the hardcoded width of 6 will be used there anyway.

This fixes an issue on systems with a monitor resolution of .e.g 3840x2160, without Hi-DPI scaling (since Qt disables font hinting altogether when Hi-DPI scaling is used, this is still a viable use-case) where the slider width is too thin.

This was tested on a 3840x2160 monitor using X11.

Merge request reports