Add sample qml application
[staging/HomeScreen.git] / sample-qml / imports / components / DateTime.qml
diff --git a/sample-qml/imports/components/DateTime.qml b/sample-qml/imports/components/DateTime.qml
new file mode 100644 (file)
index 0000000..6203712
--- /dev/null
@@ -0,0 +1,35 @@
+/* Copyright (C) 2015, Jaguar Land Rover. All Rights Reserved.\r
+ *\r
+ * This Source Code Form is subject to the terms of the Mozilla Public\r
+ * License, v. 2.0. If a copy of the MPL was not distributed with this\r
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
+\r
+import QtQuick 2.0\r
+import utils 1.0\r
+\r
+Item {\r
+    id: dateTime\r
+    anchors.left: parent.left\r
+    anchors.right: parent.right\r
+    height: 120\r
+    property var timeStamp: new Date()\r
+\r
+    Timer {\r
+        interval: 1000\r
+        running: true\r
+        repeat: true\r
+        onTriggered: timeStamp = new Date()\r
+    }\r
+\r
+    Label {\r
+        fontColor: Style.grey\r
+        text: Qt.formatDate(timeStamp, "ddd MMM d")\r
+    }\r
+\r
+    Label {\r
+        anchors.right: parent.right\r
+        fontColor: Style.grey\r
+        text: Qt.formatTime(timeStamp, "h:mm AP")\r
+    }\r
+}\r
+\r