I run Linux without desktop environment on a 4K screen, so I ran into this stuff on all GUI kits.
I set the respective scale detection/factor variable in my environment and be done, e.g., for QT5 it'd be:
Normally, the desktop environment should do this for you, though. But yeah, this was quite horrible for me for a long time and only got better recently (~ 1 to 2 years), with an wider adoption of high DPI screens, I'd guess.
export QT_AUTO_SCREEN_SCALE_FACTOR=1
for auto scaling. See: https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-... and https://wiki.archlinux.org/index.php/HiDPI#Qt_5 for more options and other UI kits.
Normally, the desktop environment should do this for you, though. But yeah, this was quite horrible for me for a long time and only got better recently (~ 1 to 2 years), with an wider adoption of high DPI screens, I'd guess.