Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorZones::Zone Class Reference

Represents a single zone within a layout. More...

#include <phosphor-zones/include/PhosphorZones/Zone.h>

Inheritance diagram for PhosphorZones::Zone:
[legend]

Signals

void nameChanged ()
 
void geometryChanged ()
 
void relativeGeometryChanged ()
 
void zoneNumberChanged ()
 
void highlightColorChanged ()
 
void inactiveColorChanged ()
 
void borderColorChanged ()
 
void activeOpacityChanged ()
 
void inactiveOpacityChanged ()
 
void borderWidthChanged ()
 
void borderRadiusChanged ()
 
void highlightedChanged ()
 
void useCustomColorsChanged ()
 
void overlayDisplayModeChanged ()
 
void geometryModeChanged ()
 
void fixedGeometryChanged ()
 

Public Member Functions

 Zone (QObject *parent=nullptr)
 
 Zone (const QRectF &geometry, QObject *parent=nullptr)
 
 ~Zone () override=default
 
 Zone (const Zone &)=delete
 
Zoneoperator= (const Zone &)=delete
 
Zoneclone (QObject *parent=nullptr) const
 Creates a copy of this zone with a new unique ID.
 
void copyPropertiesFrom (const Zone &other)
 Copies properties from another zone (excluding ID)
 
QUuid id () const
 
QString name () const
 
void setName (const QString &name)
 
QRectF geometry () const
 
void setGeometry (const QRectF &geometry)
 
QRectF relativeGeometry () const
 
void setRelativeGeometry (const QRectF &relativeGeometry)
 
int zoneNumber () const
 
void setZoneNumber (int number)
 
QColor highlightColor () const
 
void setHighlightColor (const QColor &color)
 
QColor inactiveColor () const
 
void setInactiveColor (const QColor &color)
 
QColor borderColor () const
 
void setBorderColor (const QColor &color)
 
qreal activeOpacity () const
 
void setActiveOpacity (qreal opacity)
 
qreal inactiveOpacity () const
 
void setInactiveOpacity (qreal opacity)
 
int borderWidth () const
 
void setBorderWidth (int width)
 
int borderRadius () const
 
void setBorderRadius (int radius)
 
bool isHighlighted () const
 
void setHighlighted (bool highlighted)
 
bool useCustomColors () const
 
void setUseCustomColors (bool useCustom)
 
int overlayDisplayMode () const
 
void setOverlayDisplayMode (int mode)
 
ZoneGeometryMode geometryMode () const
 
int geometryModeInt () const
 
bool isFixedGeometry () const
 
void setGeometryMode (ZoneGeometryMode mode)
 
void setGeometryModeInt (int mode)
 
QRectF fixedGeometry () const
 
void setFixedGeometry (const QRectF &geometry)
 
QRectF normalizedGeometry (const QRectF &referenceGeometry) const
 Returns normalized 0-1 coordinates regardless of geometry mode.
 
bool containsPoint (const QPointF &point) const
 
qreal distanceToPoint (const QPointF &point) const
 
QRectF calculateAbsoluteGeometry (const QRectF &screenGeometry) const
 
QRectF applyPadding (int padding) const
 
QJsonObject toJson (const QRectF &referenceGeometry=QRectF()) const
 

Static Public Member Functions

static QRectF computeAbsoluteGeometry (ZoneGeometryMode mode, const QRectF &relativeGeometry, const QRectF &fixedGeometry, const QRectF &screenGeometry)
 Pure helper shared between Zone::calculateAbsoluteGeometry and LayoutWorker (which runs off-thread and cannot touch QObjects).
 
static ZonefromJson (const QJsonObject &json, QObject *parent=nullptr)
 

Detailed Description

Represents a single zone within a layout.

A zone is a rectangular area on the screen where windows can be snapped. Zones support custom colors, names, and keyboard shortcuts for ricer-friendly customization.

Note: Zone inherits from QObject and follows Qt's object model. QObjects should NOT be copied - use clone() to create duplicates.

Constructor & Destructor Documentation

◆ Zone() [1/3]

PhosphorZones::Zone::Zone ( QObject *  parent = nullptr)
explicit

◆ Zone() [2/3]

PhosphorZones::Zone::Zone ( const QRectF &  geometry,
QObject *  parent = nullptr 
)
explicit

◆ ~Zone()

PhosphorZones::Zone::~Zone ( )
overridedefault

◆ Zone() [3/3]

PhosphorZones::Zone::Zone ( const Zone )
delete

Member Function Documentation

◆ activeOpacity()

qreal PhosphorZones::Zone::activeOpacity ( ) const
inline

◆ activeOpacityChanged

void PhosphorZones::Zone::activeOpacityChanged ( )
signal

◆ applyPadding()

QRectF PhosphorZones::Zone::applyPadding ( int  padding) const

◆ borderColor()

QColor PhosphorZones::Zone::borderColor ( ) const
inline

◆ borderColorChanged

void PhosphorZones::Zone::borderColorChanged ( )
signal

◆ borderRadius()

int PhosphorZones::Zone::borderRadius ( ) const
inline

◆ borderRadiusChanged

void PhosphorZones::Zone::borderRadiusChanged ( )
signal

◆ borderWidth()

int PhosphorZones::Zone::borderWidth ( ) const
inline

◆ borderWidthChanged

void PhosphorZones::Zone::borderWidthChanged ( )
signal

◆ calculateAbsoluteGeometry()

QRectF PhosphorZones::Zone::calculateAbsoluteGeometry ( const QRectF &  screenGeometry) const

◆ clone()

Zone * PhosphorZones::Zone::clone ( QObject *  parent = nullptr) const

Creates a copy of this zone with a new unique ID.

Parameters
parentParent object for the new zone
Returns
New Zone instance with copied properties but new ID

◆ computeAbsoluteGeometry()

static QRectF PhosphorZones::Zone::computeAbsoluteGeometry ( ZoneGeometryMode  mode,
const QRectF &  relativeGeometry,
const QRectF &  fixedGeometry,
const QRectF &  screenGeometry 
)
static

Pure helper shared between Zone::calculateAbsoluteGeometry and LayoutWorker (which runs off-thread and cannot touch QObjects).

Fixed mode: pixel coords relative to screen origin. Relative mode: 0..1 coords multiplied by screen dimensions.

◆ containsPoint()

bool PhosphorZones::Zone::containsPoint ( const QPointF &  point) const

◆ copyPropertiesFrom()

void PhosphorZones::Zone::copyPropertiesFrom ( const Zone other)

Copies properties from another zone (excluding ID)

Parameters
otherSource zone to copy from

◆ distanceToPoint()

qreal PhosphorZones::Zone::distanceToPoint ( const QPointF &  point) const

◆ fixedGeometry()

QRectF PhosphorZones::Zone::fixedGeometry ( ) const
inline

◆ fixedGeometryChanged

void PhosphorZones::Zone::fixedGeometryChanged ( )
signal

◆ fromJson()

static Zone * PhosphorZones::Zone::fromJson ( const QJsonObject &  json,
QObject *  parent = nullptr 
)
static

◆ geometry()

QRectF PhosphorZones::Zone::geometry ( ) const
inline

◆ geometryChanged

void PhosphorZones::Zone::geometryChanged ( )
signal

◆ geometryMode()

ZoneGeometryMode PhosphorZones::Zone::geometryMode ( ) const
inline

◆ geometryModeChanged

void PhosphorZones::Zone::geometryModeChanged ( )
signal

◆ geometryModeInt()

int PhosphorZones::Zone::geometryModeInt ( ) const
inline

◆ highlightColor()

QColor PhosphorZones::Zone::highlightColor ( ) const
inline

◆ highlightColorChanged

void PhosphorZones::Zone::highlightColorChanged ( )
signal

◆ highlightedChanged

void PhosphorZones::Zone::highlightedChanged ( )
signal

◆ id()

QUuid PhosphorZones::Zone::id ( ) const
inline

◆ inactiveColor()

QColor PhosphorZones::Zone::inactiveColor ( ) const
inline

◆ inactiveColorChanged

void PhosphorZones::Zone::inactiveColorChanged ( )
signal

◆ inactiveOpacity()

qreal PhosphorZones::Zone::inactiveOpacity ( ) const
inline

◆ inactiveOpacityChanged

void PhosphorZones::Zone::inactiveOpacityChanged ( )
signal

◆ isFixedGeometry()

bool PhosphorZones::Zone::isFixedGeometry ( ) const
inline

◆ isHighlighted()

bool PhosphorZones::Zone::isHighlighted ( ) const
inline

◆ name()

QString PhosphorZones::Zone::name ( ) const
inline

◆ nameChanged

void PhosphorZones::Zone::nameChanged ( )
signal

◆ normalizedGeometry()

QRectF PhosphorZones::Zone::normalizedGeometry ( const QRectF &  referenceGeometry) const

Returns normalized 0-1 coordinates regardless of geometry mode.

Parameters
referenceGeometryThe screen geometry to normalize against
Returns
Normalized coordinates for spatial queries

For Relative mode: returns relativeGeometry() directly. For Fixed mode: converts fixedGeometry pixel coords to 0-1 relative to referenceGeometry dimensions.

◆ operator=()

Zone & PhosphorZones::Zone::operator= ( const Zone )
delete

◆ overlayDisplayMode()

int PhosphorZones::Zone::overlayDisplayMode ( ) const
inline

◆ overlayDisplayModeChanged

void PhosphorZones::Zone::overlayDisplayModeChanged ( )
signal

◆ relativeGeometry()

QRectF PhosphorZones::Zone::relativeGeometry ( ) const
inline

◆ relativeGeometryChanged

void PhosphorZones::Zone::relativeGeometryChanged ( )
signal

◆ setActiveOpacity()

void PhosphorZones::Zone::setActiveOpacity ( qreal  opacity)

◆ setBorderColor()

void PhosphorZones::Zone::setBorderColor ( const QColor &  color)

◆ setBorderRadius()

void PhosphorZones::Zone::setBorderRadius ( int  radius)

◆ setBorderWidth()

void PhosphorZones::Zone::setBorderWidth ( int  width)

◆ setFixedGeometry()

void PhosphorZones::Zone::setFixedGeometry ( const QRectF &  geometry)

◆ setGeometry()

void PhosphorZones::Zone::setGeometry ( const QRectF &  geometry)

◆ setGeometryMode()

void PhosphorZones::Zone::setGeometryMode ( ZoneGeometryMode  mode)

◆ setGeometryModeInt()

void PhosphorZones::Zone::setGeometryModeInt ( int  mode)

◆ setHighlightColor()

void PhosphorZones::Zone::setHighlightColor ( const QColor &  color)

◆ setHighlighted()

void PhosphorZones::Zone::setHighlighted ( bool  highlighted)

◆ setInactiveColor()

void PhosphorZones::Zone::setInactiveColor ( const QColor &  color)

◆ setInactiveOpacity()

void PhosphorZones::Zone::setInactiveOpacity ( qreal  opacity)

◆ setName()

void PhosphorZones::Zone::setName ( const QString &  name)

◆ setOverlayDisplayMode()

void PhosphorZones::Zone::setOverlayDisplayMode ( int  mode)

◆ setRelativeGeometry()

void PhosphorZones::Zone::setRelativeGeometry ( const QRectF &  relativeGeometry)

◆ setUseCustomColors()

void PhosphorZones::Zone::setUseCustomColors ( bool  useCustom)

◆ setZoneNumber()

void PhosphorZones::Zone::setZoneNumber ( int  number)

◆ toJson()

QJsonObject PhosphorZones::Zone::toJson ( const QRectF &  referenceGeometry = QRectF()) const

◆ useCustomColors()

bool PhosphorZones::Zone::useCustomColors ( ) const
inline

◆ useCustomColorsChanged

void PhosphorZones::Zone::useCustomColorsChanged ( )
signal

◆ zoneNumber()

int PhosphorZones::Zone::zoneNumber ( ) const
inline

◆ zoneNumberChanged

void PhosphorZones::Zone::zoneNumberChanged ( )
signal

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