Automatic rescaling of an application on high-dpi Windows platform?

后端 未结 5 964
轮回少年
轮回少年 2020-11-28 10:48

I\'m writing a Qt application that needs to run on high-dpi Windows (192dpi instead of 96dpi).

Unfortunately the Qt framework does not have support for high-dpi yet

5条回答
  •  抹茶落季
    2020-11-28 11:21

    I' am using Qt 4.8. First, you should use layouts. My goal was to prevent user to resize dialogs, forms etc. too.

    I achieved correct display results on different DPI by put this code in dialog constructor:

    adjustSize();
    setFixedSize(size());
    

    First line adjustSize() adjust size of dialog to fit its content. Second line setFixedSize(size()) fixes size of dialog after adjusting its size to content and prevent users to resize it. You haven't to set size policies.

提交回复
热议问题