Real-time clock for status bar widgets. More...
#include <phosphor-shell/include/PhosphorShell/SystemClock.h>
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 |
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 }
|
explicit |
|
override |
| QDate PhosphorShell::SystemClock::date | ( | ) | const |
|
signal |
| bool PhosphorShell::SystemClock::enabled | ( | ) | const |
|
signal |
| int PhosphorShell::SystemClock::hours | ( | ) | const |
| int PhosphorShell::SystemClock::minutes | ( | ) | const |
| Precision PhosphorShell::SystemClock::precision | ( | ) | const |
|
signal |
| int PhosphorShell::SystemClock::seconds | ( | ) | const |
| void PhosphorShell::SystemClock::setEnabled | ( | bool | enabled | ) |
| void PhosphorShell::SystemClock::setPrecision | ( | Precision | precision | ) |
|
signal |