Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorLayout::ScreenClassification Namespace Reference

Screen classification thresholds and utilities. More...

Functions

AspectRatioClass classify (qreal aspectRatio)
 
AspectRatioClass classify (int width, int height)
 
QString toString (AspectRatioClass cls)
 
AspectRatioClass fromString (const QString &str)
 
qreal aspectRatioForClass (AspectRatioClass cls, qreal fallback=16.0/9.0)
 Representative aspect ratio for a class.
 
bool matches (AspectRatioClass layoutClass, AspectRatioClass screenClass)
 Check if a layout's aspect ratio class matches the given screen class.
 

Variables

constexpr qreal PortraitMax = 1.0
 AR < 1.0 → portrait.
 
constexpr qreal UltrawideMin = 1.9
 AR ∈ [UltrawideMin, SuperUltrawideMin) → ultrawide.
 
constexpr qreal SuperUltrawideMin = 2.8
 AR >= 2.8 → super-ultrawide.
 

Detailed Description

Screen classification thresholds and utilities.

Free helpers separated from the enum so consumers can pull just the enum without dragging the threshold constants into namespace pollution.

Function Documentation

◆ aspectRatioForClass()

qreal PhosphorLayout::ScreenClassification::aspectRatioForClass ( AspectRatioClass  cls,
qreal  fallback = 16.0 / 9.0 
)
inline

Representative aspect ratio for a class.

Parameters
clsThe aspect ratio class.
fallbackValue to return for AspectRatioClass::Any (default 16:9).

◆ classify() [1/2]

AspectRatioClass PhosphorLayout::ScreenClassification::classify ( int  width,
int  height 
)
inline

◆ classify() [2/2]

AspectRatioClass PhosphorLayout::ScreenClassification::classify ( qreal  aspectRatio)
inline

◆ fromString()

AspectRatioClass PhosphorLayout::ScreenClassification::fromString ( const QString &  str)
inline

◆ matches()

bool PhosphorLayout::ScreenClassification::matches ( AspectRatioClass  layoutClass,
AspectRatioClass  screenClass 
)
inline

Check if a layout's aspect ratio class matches the given screen class.

A layout with AspectRatioClass::Any matches every screen. Otherwise, exact match is required unless the layout specifies explicit min/max aspect ratio bounds (which take precedence at the layout consumer's level — this helper just does the class match).

◆ toString()

QString PhosphorLayout::ScreenClassification::toString ( AspectRatioClass  cls)
inline

Variable Documentation

◆ PortraitMax

constexpr qreal PhosphorLayout::ScreenClassification::PortraitMax = 1.0
constexpr

AR < 1.0 → portrait.

◆ SuperUltrawideMin

constexpr qreal PhosphorLayout::ScreenClassification::SuperUltrawideMin = 2.8
constexpr

AR >= 2.8 → super-ultrawide.

◆ UltrawideMin

constexpr qreal PhosphorLayout::ScreenClassification::UltrawideMin = 1.9
constexpr

AR ∈ [UltrawideMin, SuperUltrawideMin) → ultrawide.