HomeForm.qml 783 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import QtQuick 2.0
  2. import QtQuick.Controls 2.0
  3. Page {
  4. title: qsTr("nooLight")
  5. function showError(text) {
  6. ToolTip.show(text, 1000)
  7. }
  8. LightsModel {
  9. id: lightsModel
  10. serviceUrl: settings.serviceUrl
  11. onError: showError(text)
  12. }
  13. ListView {
  14. anchors.fill: parent
  15. anchors.margins: 5
  16. model: lightsModel
  17. spacing: 5
  18. delegate: LightGroup {
  19. width: parent.width
  20. height: childrenRect.height
  21. title: groupName || ""
  22. lights: channels
  23. onChannelClicked: {
  24. lightsModel.switchChannel(channelId)
  25. }
  26. }
  27. }
  28. BusyIndicator {
  29. anchors.centerIn: parent
  30. running: lightsModel.isLoading
  31. }
  32. }