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

Real-time clock for status bar widgets. More...

#include <PhosphorShell/SystemClock.h>

Inheritance diagram for PhosphorShell::SystemClock:
[legend]

Public Types

enum  Precision { Hours , Minutes , Seconds }

Signals

void enabledChanged ()
void precisionChanged ()
void timeChanged ()
void dateChanged ()
void timeZoneChanged ()

Public Member Functions

 SystemClock (QObject *parent=nullptr)
 ~SystemClock () override
bool enabled () const
void setEnabled (bool enabled)
Precision precision () const
void setPrecision (Precision precision)
int hours () const
int minutes () const
int seconds () const
QDate date () const
QString timeZoneName () const
QString timeZoneAbbreviation () const
int utcOffsetMinutes () const

Detailed Description

Real-time clock for status bar widgets.

hours, minutes and seconds are always populated; precision governs only how often the clock re-samples the wall clock (every second, minute, or hour) — a coarser precision simply means the finer fields refresh less often, never that they are invalid. The timer is stopped entirely when enabled is false, so inactive clocks consume zero CPU.

Usage from QML:

import Phosphor.Shell
SystemClock {
    id: clock
    precision: SystemClock.Minutes
}
Text { text: clock.hours + ":" + clock.minutes } 

Member Enumeration Documentation

◆ Precision

Enumerator
Hours 
Minutes 
Seconds 

Constructor & Destructor Documentation

◆ SystemClock()

PhosphorShell::SystemClock::SystemClock ( QObject * parent = nullptr)
explicit

◆ ~SystemClock()

PhosphorShell::SystemClock::~SystemClock ( )
override

Member Function Documentation

◆ date()

QDate PhosphorShell::SystemClock::date ( ) const
nodiscard

◆ dateChanged

void PhosphorShell::SystemClock::dateChanged ( )
signal

◆ enabled()

bool PhosphorShell::SystemClock::enabled ( ) const
nodiscard

◆ enabledChanged

void PhosphorShell::SystemClock::enabledChanged ( )
signal

◆ hours()

int PhosphorShell::SystemClock::hours ( ) const
nodiscard

◆ minutes()

int PhosphorShell::SystemClock::minutes ( ) const
nodiscard

◆ precision()

Precision PhosphorShell::SystemClock::precision ( ) const
nodiscard

◆ precisionChanged

void PhosphorShell::SystemClock::precisionChanged ( )
signal

◆ seconds()

int PhosphorShell::SystemClock::seconds ( ) const
nodiscard

◆ setEnabled()

void PhosphorShell::SystemClock::setEnabled ( bool enabled)

◆ setPrecision()

void PhosphorShell::SystemClock::setPrecision ( Precision precision)

◆ timeChanged

void PhosphorShell::SystemClock::timeChanged ( )
signal

◆ timeZoneAbbreviation()

QString PhosphorShell::SystemClock::timeZoneAbbreviation ( ) const
inlinenodiscard

◆ timeZoneChanged

void PhosphorShell::SystemClock::timeZoneChanged ( )
signal

◆ timeZoneName()

QString PhosphorShell::SystemClock::timeZoneName ( ) const
inlinenodiscard

◆ utcOffsetMinutes()

int PhosphorShell::SystemClock::utcOffsetMinutes ( ) const
inlinenodiscard

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