Class: QgsScreenProperties

class qgis.core.QgsScreenProperties

Bases: sip.wrapper

Stores properties relating to a screen.

This class is designed to be a publicly constructible, copyable store for the properties available from a QScreen object.

Added in version 3.32.

QgsScreenProperties() Constructor for invalid properties.

QgsScreenProperties(screen: QScreen) Constructor for QgsScreenProperties, copying properties from the specified screen.

QgsScreenProperties(QgsScreenProperties)

Methods

devicePixelRatio

Returns the ratio between physical pixels and device-independent pixels for the screen.

isValid

Returns True if the properties are valid.

physicalDpi

This property holds the number of physical dots or pixels per inch.

setDevicePixelRatio

Sets the ratio between physical pixels and device-independent pixels for the screen.

setPhysicalDpi

Sets number of physical dots or pixels per inch.

updateRenderContextForScreen

Updates the settings in a render context to match the screen settings.

devicePixelRatio(self) float

Returns the ratio between physical pixels and device-independent pixels for the screen.

This property holds the screen’s ratio between physical pixels and device-independent pixels.

Common values are 1.0 on normal displays and 2.0 on “retina” displays. Higher values are also possible.

Return type:

float

isValid(self) bool

Returns True if the properties are valid.

Return type:

bool

physicalDpi(self) float

This property holds the number of physical dots or pixels per inch.

This value represents the pixel density on the screen’s display. Depending on what information the underlying system provides the value might not be entirely accurate.

Note

Physical DPI is expressed in device-independent dots. Multiply by devicePixelRatio() to get device-dependent density.

See also

setPhysicalDpi()

Return type:

float

setDevicePixelRatio(self, ratio: float)

Sets the ratio between physical pixels and device-independent pixels for the screen.

This property holds the screen’s ratio between physical pixels and device-independent pixels.

Common values are 1.0 on normal displays and 2.0 on “retina” displays. Higher values are also possible.

Parameters:

ratio (float)

setPhysicalDpi(self, dpi: float)

Sets number of physical dots or pixels per inch.

This value represents the pixel density on the screen’s display. Depending on what information the underlying system provides the value might not be entirely accurate.

Note

Physical DPI is expressed in device-independent dots. Multiply by devicePixelRatio() to get device-dependent density.

See also

physicalDpi()

Parameters:

dpi (float)

updateRenderContextForScreen(self, context: QgsRenderContext)

Updates the settings in a render context to match the screen settings.

Parameters:

context (QgsRenderContext)