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 <phosphor-shell/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 ()
 

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
 

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

◆ dateChanged

void PhosphorShell::SystemClock::dateChanged ( )
signal

◆ enabled()

bool PhosphorShell::SystemClock::enabled ( ) const

◆ enabledChanged

void PhosphorShell::SystemClock::enabledChanged ( )
signal

◆ hours()

int PhosphorShell::SystemClock::hours ( ) const

◆ minutes()

int PhosphorShell::SystemClock::minutes ( ) const

◆ precision()

Precision PhosphorShell::SystemClock::precision ( ) const

◆ precisionChanged

void PhosphorShell::SystemClock::precisionChanged ( )
signal

◆ seconds()

int PhosphorShell::SystemClock::seconds ( ) const

◆ setEnabled()

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

◆ setPrecision()

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

◆ timeChanged

void PhosphorShell::SystemClock::timeChanged ( )
signal

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