QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | List of all members
QgsScreenProperties Class Reference

Stores properties relating to a screen. More...

#include <qgsscreenproperties.h>

Public Member Functions

 QgsScreenProperties ()
 Constructor for invalid properties. More...
 
 QgsScreenProperties (const QScreen *screen)
 Constructor for QgsScreenProperties, copying properties from the specified screen. More...
 
double devicePixelRatio () const
 Returns the ratio between physical pixels and device-independent pixels for the screen. More...
 
bool isValid () const
 Returns true if the properties are valid. More...
 
bool operator!= (const QgsScreenProperties &other) const
 
bool operator== (const QgsScreenProperties &other) const
 
double physicalDpi () const
 This property holds the number of physical dots or pixels per inch. More...
 
void setDevicePixelRatio (double ratio)
 Sets the ratio between physical pixels and device-independent pixels for the screen. More...
 
void setPhysicalDpi (double dpi)
 Sets number of physical dots or pixels per inch. More...
 
void updateRenderContextForScreen (QgsRenderContext &context) const
 Updates the settings in a render context to match the screen settings. More...
 

Detailed Description

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.

Since
QGIS 3.32

Definition at line 35 of file qgsscreenproperties.h.

Constructor & Destructor Documentation

◆ QgsScreenProperties() [1/2]

QgsScreenProperties::QgsScreenProperties ( )
default

Constructor for invalid properties.

◆ QgsScreenProperties() [2/2]

QgsScreenProperties::QgsScreenProperties ( const QScreen *  screen)
explicit

Constructor for QgsScreenProperties, copying properties from the specified screen.

Definition at line 23 of file qgsscreenproperties.cpp.

Member Function Documentation

◆ devicePixelRatio()

double QgsScreenProperties::devicePixelRatio ( ) const
inline

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
setDevicePixelRatio()

Definition at line 77 of file qgsscreenproperties.h.

◆ isValid()

bool QgsScreenProperties::isValid ( ) const
inline

Returns true if the properties are valid.

Definition at line 66 of file qgsscreenproperties.h.

◆ operator!=()

bool QgsScreenProperties::operator!= ( const QgsScreenProperties other) const
inline

Definition at line 58 of file qgsscreenproperties.h.

◆ operator==()

bool QgsScreenProperties::operator== ( const QgsScreenProperties other) const
inline

Definition at line 51 of file qgsscreenproperties.h.

◆ physicalDpi()

double QgsScreenProperties::physicalDpi ( ) const
inline

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()

Definition at line 101 of file qgsscreenproperties.h.

◆ setDevicePixelRatio()

void QgsScreenProperties::setDevicePixelRatio ( double  ratio)

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
devicePixelRatio()

Definition at line 33 of file qgsscreenproperties.cpp.

◆ setPhysicalDpi()

void QgsScreenProperties::setPhysicalDpi ( double  dpi)

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()

Definition at line 39 of file qgsscreenproperties.cpp.

◆ updateRenderContextForScreen()

void QgsScreenProperties::updateRenderContextForScreen ( QgsRenderContext context) const

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

Definition at line 45 of file qgsscreenproperties.cpp.


The documentation for this class was generated from the following files: