Qt中和DPI相关的几个术语解释(来自Qt文档)

Device Independent Pixels(设备独立像素)
    The pixels that an application uses (user space), subject to scaling by the operating system or Qt.
    
Device Pixels(设备像素)
    The display device's pixels.
    
Device Pixel Ratio(设备像素比例)
    The scale factor that either the operating system or Qt applies.
    
Logical DPI(逻辑DPI)
    The resolution used to convert font sizes defined in points to font sizes in pixels. The standard values are 96, 128, ... 192.
    我的备注:
    逻辑DPI主要用于在字体的PointSize和PixelSize两个尺寸单位间的换算。
    系统缩放和逻辑DPI的关系. 分两种情况:
    情况1: 未打开DPI缩放开关Qt::AA_EnableHighDpiScaling
        当调整系统显示的缩放比例时,逻辑DPI会变化,缩放比例越大,逻辑DPI就越大。(可以理解为inch这个单位变大了)
        这时如果字体大小是按PointSize来设置,字体就会自动改变大小,但是控件自身是不会自动改变大小的(控件是按像素设置的),所以可能出现控件上字体显示不全的问题。
        这时如果字体大小是按PixelSize来设置,由于显示器的像素并没有发生改变,因此字体大小会不改变。
    情况2: 打开了DPI缩放开关Qt::AA_EnableHighDpiScaling
        不管如何调整系统显示的缩放比例时,逻辑DPI不会变化。
        这时不论字体大小是按PointSize还是按PixelSize,Qt的DPI自适应系统都会正确的进行字体和控件的自适应缩放。

    
Physical DPI(物理DPI)
    The physical resolution obtained by dividing the size of the monitor by the number of pixels.
    我的备注:
        对于固定设备,物理DPI是固定不变的
    
User Space(用户空间)
    The coordinate space that an application uses in Device Independent Pixels.
    
    
关于Windows系统的缩放说明
    Users choose a scaling factor from the Control Panel or via the context menu. This works by making the functions for querying the system metrics return different values for standard font sizes, sizes of window borders, and so on. It doesn't perform any actual scaling.
    意思就是我们在Windows里面修改了缩放比例后,Windows其实什么也没干,只是提供了一些获取字体大小,边框大小的函数,真正的缩放需要应用程序自己实现。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值