game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
dpr Namespace Reference

Functions

qreal primaryRatio ()
 The primary screen's device pixel ratio.
QSize scaleToPhysical (const QSize &logical)
 Scale a QSize by the primary screen's DPR. Same rationale as above.
int scaleToPhysical (const QWidget *w, int logicalPixels)
 Per-widget version of scaleToPhysical — preferred when the widget is on a non-primary monitor that might have a different DPR (mixed-DPI setups, common on Wayland).
int scaleToPhysical (int logicalPixels)
 Scale a logical pixel count into a physical pixel count using the primary screen's DPR.
qreal widgetRatio (const QWidget *w)
 Device pixel ratio of the screen a given widget is currently on.

Function Documentation

◆ primaryRatio()

qreal dpr::primaryRatio ( )
inline

The primary screen's device pixel ratio.

Returns 1.0 if Qt hasn't yet established a primary screen (edge cases during very-early initialisation).

Definition at line 36 of file dpr_utils.h.

Referenced by GameThumbnailCache::getGameThumbnail(), GameThumbnailCache::getHeroImage(), scaleToPhysical(), scaleToPhysical(), and widgetRatio().

◆ scaleToPhysical() [1/3]

QSize dpr::scaleToPhysical ( const QSize & logical)
inline

Scale a QSize by the primary screen's DPR. Same rationale as above.

Definition at line 64 of file dpr_utils.h.

References primaryRatio().

◆ scaleToPhysical() [2/3]

int dpr::scaleToPhysical ( const QWidget * w,
int logicalPixels )
inline

Per-widget version of scaleToPhysical — preferred when the widget is on a non-primary monitor that might have a different DPR (mixed-DPI setups, common on Wayland).

Definition at line 74 of file dpr_utils.h.

References widgetRatio().

◆ scaleToPhysical() [3/3]

int dpr::scaleToPhysical ( int logicalPixels)
inline

Scale a logical pixel count into a physical pixel count using the primary screen's DPR.

Intended for cases where we draw into backing pixmaps that don't get DPR-aware treatment automatically (e.g. QPixmap caches keyed by physical size).

Definition at line 58 of file dpr_utils.h.

References primaryRatio().

◆ widgetRatio()

qreal dpr::widgetRatio ( const QWidget * w)
inline

Device pixel ratio of the screen a given widget is currently on.

Falls back to the primary screen's DPR if w has no screen assignment yet.

Definition at line 45 of file dpr_utils.h.

References primaryRatio().

Referenced by scaleToPhysical().