From 96d7cd593286e608bf65100eee567d9a328d40d9 Mon Sep 17 00:00:00 2001 From: Naoto Yamaguchi Date: Sun, 10 Oct 2021 01:41:40 +0900 Subject: Initial commit Signed-off-by: Naoto Yamaguchi --- DateBox.qml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 DateBox.qml (limited to 'DateBox.qml') diff --git a/DateBox.qml b/DateBox.qml new file mode 100644 index 0000000..9b7a48f --- /dev/null +++ b/DateBox.qml @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-3.0+ +// Copyright (C) 2021 AISIN CORPORATION + +import QtQuick 2.2 + +Item { + id: dateBox + property color timeColor: Qt.rgba(0.9,0.9,0.9,0.9) + property bool flashing: false + property string text: "" + property int pixSize: 20 + property var locale: Qt.locale() + property string dateString: "" + + Timer { + id: flashTimer + interval: 1000 + running: true + repeat: true + onTriggered: { + var currentDate = new Date(); + var formatString = "hh:mm ap"; + dateBoxText.text = currentDate.toLocaleTimeString(locale,formatString); + } + } + + Text { + id: dateBoxText + visible: true + font.pixelSize: pixSize + color: timeColor + horizontalAlignment: Text.AlignRight + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.verticalCenter + } +} -- cgit 1.2.3-korg