LightGroup.qml 951 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import QtQuick 2.0
  2. import QtQuick.Controls 2.2
  3. Item {
  4. id: root
  5. property string title: ""
  6. property QtObject lights: undefined
  7. Column {
  8. width: root.width
  9. spacing: 5
  10. GradientButton {
  11. width: root.width
  12. height: 40
  13. visible: Boolean(root.title)
  14. radius: 5
  15. Label {
  16. text: root.title
  17. anchors.centerIn: parent
  18. }
  19. }
  20. Row {
  21. id: buttonsRow
  22. width: root.width
  23. height: childrenRect.height
  24. spacing: 5
  25. Repeater {
  26. model: root.lights
  27. width: root.width
  28. GradientButton {
  29. width: (root.width - buttonsRow.spacing * (root.lights.count - 1)) / root.lights.count
  30. height: width / 2
  31. radius: 5
  32. }
  33. }
  34. }
  35. }
  36. }