aboutsummaryrefslogtreecommitdiffstats
path: root/DateBox.qml
diff options
context:
space:
mode:
Diffstat (limited to 'DateBox.qml')
-rw-r--r--DateBox.qml36
1 files changed, 36 insertions, 0 deletions
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
+ }
+}