

This allows applications written for low DPI screens to run unchanged on high DPI devices.

Qt provides the following ways for you to handle high DPI support in your application. platform windows:dpiawareness = 0, 1, 2įor more information, see Using qt.conf. On macOS, high-DPI support is enabled by settings in the ist file so make sure these settings are present. Normally, no special configuration is required. The Apple platforms implement scaling and coordinate system virtualization in the operating system. The Qt-supported operating systems offer the following for high DPI displays: macOS and iOS
HOW TO ZOOM TEXT ON 4K MONITOR MAC CODE
Typically, most applications work with device independent pixels except for OpenGL and code for raster graphics. The devicePixelRatio is the ratio between the device independent pixels and the device pixel coordinate system. The output is rendered in device pixels, which corresponds to the display resolution. This includes widget and item geometry, event geometry, desktop, window and screen geometry, as well as animation velocities. Now, geometry is specified in device independent pixels. Additionally, if an operating system doesn't support this mode, Qt has an implementation to fallback on. Some operating systems, like macOS and iOS implement this mode. Qt supports a high DPI mode where the main coordinate system is virtualized and made independent from the display pixel density. Traditionally, to support high DPI, Qt scales fonts automatically and provides a DPI value that application code can use to scale the rest of the UI. Applications must adapt to situations where users have multiple displays with varying resolutionsįor example, a user might use a 4K monitor for the document window of an image editor but a low resolution monitor for the tool box.But, on high DPI monitors, the frame would be too small, resulting in the text being clipped. If we use a 12pt font, it would look correct on low resolution monitors.

For example, suppose we have a frame of 40x20 pixels around the text "hello". The combination of specifying font size in points and other sizes in pixels is particularly problematic because points are independent from the monitor's resolution. Applications using UI designs with fixed coordinates look small.High DPI displays bring about some challenges for existing applications: The former is around twice the standard 96 DPI desktop resolution the latter barely exceeds this resolution. Consequently, the number of pixels alone isn't enough to determine if a display falls into the high-DPI category.Ī 4K monitor has a fixed number of pixels (~8M), however its DPI varies between 185 (23 inches) and 110 (40 inches). Pixel density is measured in Dots per Inch (DPI) or Pixels per Inch (PPI), and is determined by the number of display pixels and their size. High DPI displays have increased pixel density, compared to standard DPI displays.
