MainMenu.qml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import QtQuick 2.15
  2. import QtQuick.Controls 2.15
  3. Drawer {
  4. property alias logo: logoImage.source
  5. property alias appName: appNameLabel.text
  6. property alias model: menuRepeater.model
  7. property alias connected: connectionLabel.connected
  8. signal actionSelected(var action)
  9. width: parent.width * 0.66
  10. height: parent.height
  11. Column {
  12. anchors.fill: parent
  13. Row {
  14. width: parent.width
  15. height: 100
  16. Image {
  17. id: logoImage
  18. anchors.top: parent.top
  19. anchors.bottom: parent.bottom
  20. anchors.margins: 10
  21. }
  22. Column {
  23. anchors.verticalCenter: parent.verticalCenter
  24. Label {
  25. id: appNameLabel
  26. font.pointSize: 20
  27. }
  28. Label {
  29. id: connectionLabel
  30. property bool connected: false
  31. text: connected ? qsTr("Online") : qsTr("Offline")
  32. color: connected ? "green" : "red"
  33. }
  34. }
  35. }
  36. Repeater {
  37. id: menuRepeater
  38. delegate: ItemDelegate {
  39. width: parent.width
  40. text: model.title
  41. onClicked: actionSelected(model.action)
  42. }
  43. }
  44. }
  45. }