Clock.qml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import QtQuick 2.6
  2. // Required for effortless web serving!
  3. import ".."
  4. Widget {
  5. id: root
  6. text: d.timeString
  7. QtObject {
  8. id: d
  9. property string timeString
  10. property int day
  11. property int month
  12. function timeChanged() {
  13. var date = new Date;
  14. timeString = Qt.formatDateTime(date, "hh:mm")
  15. day = Qt.formatDateTime(date, "dd")
  16. month = Qt.formatDateTime(date, "MM")
  17. }
  18. }
  19. Timer {
  20. interval: 10*1000; running: true; repeat: true;
  21. onTriggered: d.timeChanged()
  22. }
  23. /*Item {
  24. anchors { left: clockLabel.right; leftMargin: 20 }
  25. height: root.height
  26. width: childrenRect.width
  27. Item {
  28. width: childrenRect.width
  29. height: parent.height/2
  30. Text {
  31. anchors.centerIn: parent
  32. color: "white"
  33. font.bold: true
  34. verticalAlignment: Text.AlignVCenter
  35. horizontalAlignment: Text.AlignHCenter
  36. font.pixelSize: root.height/3
  37. text: d.day
  38. }
  39. }
  40. Item {
  41. y: parent.height/2
  42. width: childrenRect.width
  43. height: parent.height/2
  44. Text {
  45. anchors.centerIn: parent
  46. color: "white"
  47. font.bold: true
  48. verticalAlignment: Text.AlignVCenter
  49. horizontalAlignment: Text.AlignHCenter
  50. font.pixelSize: root.height/3
  51. text: d.month
  52. }
  53. }
  54. }*/
  55. }