c++ - Qt中的logicalDpiX和physicalDpiX有什么区别?

标签 c++ qt fonts dpi

QPaintDevice 的文档中(所有paintable-to实体都派生自,例如QWidgetQPixmap等),有两个函数接收设备的DPI

int logicalDpiX() const;
int physicalDpiX() const;

int logicalDpiY() const;
int physicalDpiY() const;

文档说

The logicalDpiX() and logicalDpiY() functions return the horizontal and vertical resolution of the device in dots per inch. The physicalDpiX() and physicalDpiY() functions also return the resolution of the device in dots per inch, but note that if the logical and physical resolution differ, the corresponding QPaintEngine must handle the mapping. Finally, the colorCount() function returns the number of different colors available for the paint device.

尽管有这样的描述,我还是不明白区别的目的是什么。有人可以解释一下吗?

最佳答案

我假设物理分辨率是设备的实际分辨率,逻辑分辨率是用户在操作系统首选项中设置的分辨率。这在视网膜或其他高分辨率显示器中很流行,在这些显示器中使用物理点作为像素会导致一切都太小。

我找到了这个 windows 特定信息:http://msdn.microsoft.com/en-us/library/windows/apps/ff684173

Because actual pixel sizes vary, text that is readable on one monitor might be too small on another monitor. Also, people have different preferences—some people prefer larger text. For this reason, Windows enables the user to change the DPI setting. For example, if the user sets the display to 144 DPI, a 72-point font is 144 pixels tall. The standard DPI settings are 100% (96 DPI), 125% (120 DPI), and 150% (144 DPI). The user can also apply a custom setting. Starting in Windows 7, DPI is a per-user setting.

更好的是: QT docs :

A note on logical vs physical dots per inch: physical DPI is based on the actual physical pixel sizes when available, and is useful for print preview and other cases where it's desirable to know the exact physical dimensions of screen displayed contents. Logical dots per inch are used to convert font and user interface elements from point sizes to pixel sizes, and might be different from the physical dots per inch. The logical dots per inch are sometimes user-settable in the desktop environment's settings panel, to let the user globally control UI and font sizes in different applications.

关于c++ - Qt中的logicalDpiX和physicalDpiX有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16561879/

相关文章:

c++ - 函数的宏参数

c++ - 为 C 和 C++ 安装 MessagePack 实现时出现链接器错误

java - 是否有可能使函数像 for 循环一样工作?

javascript - 使用 Adob​​e Edge 为 Phonegap 自定义字体

ios - 如何在 Objective-c 中使用 "private use area"字体

c++ - 夸脱。如何按位置(x 和 y 值)获取图形项

c++ - Qt 对话框窗口禁用 alwaysontop 导致窗口关闭

c++ - Qt QSystemTrayIcon 不发送激活信号

c++ - 如何在 C++ 中访问 3D 对象的最小和最大坐标?

c# - 获取 .ttf 文件的字体名称