qs: use SystemClock.date in clock
This commit is contained in:
parent
324d1aad9d
commit
88a355ebe4
|
@ -32,11 +32,7 @@ BarWidgetInner {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
text: {
|
text: Qt.formatDateTime(clock.date, "hh\nmm")
|
||||||
const hours = clock.hours.toString().padStart(2, '0')
|
|
||||||
const minutes = clock.minutes.toString().padStart(2, '0')
|
|
||||||
return `${hours}\n${minutes}`
|
|
||||||
}
|
|
||||||
font.pointSize: 18
|
font.pointSize: 18
|
||||||
color: "white"
|
color: "white"
|
||||||
}
|
}
|
||||||
|
@ -52,15 +48,7 @@ BarWidgetInner {
|
||||||
Loader {
|
Loader {
|
||||||
active: tooltip.visible
|
active: tooltip.visible
|
||||||
sourceComponent: Label {
|
sourceComponent: Label {
|
||||||
text: {
|
text: Qt.formatDateTime(clock.date, "hh:mm:ss\ndddd, MMMM d, yyyy");
|
||||||
// SystemClock can send an update slightly (<50ms) before the
|
|
||||||
// time changes. We use its readout so the widget and tooltip match.
|
|
||||||
const hours = clock.hours.toString().padStart(2, '0');
|
|
||||||
const minutes = clock.minutes.toString().padStart(2, '0');
|
|
||||||
const seconds = clock.seconds.toString().padStart(2, '0');
|
|
||||||
|
|
||||||
return `${hours}:${minutes}:${seconds}\n` + new Date().toLocaleString(Qt.locale("en_US"), "dddd, MMMM d, yyyy");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue