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 specifiedscreen
.QgsScreenProperties(
QgsScreenProperties
)Methods
Returns the ratio between physical pixels and device-independent pixels for the screen.
Returns
True
if the properties are valid.This property holds the number of physical dots or pixels per inch.
Sets the
ratio
between physical pixels and device-independent pixels for the screen.Sets number of physical dots or pixels per inch.
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.
See also
- 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
- 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.
See also
- 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
- Parameters:
dpi (float)
- updateRenderContextForScreen(self, context: QgsRenderContext)¶
Updates the settings in a render
context
to match the screen settings.- Parameters:
context (QgsRenderContext)