Kstars

KSLed.qml
1 // SPDX-FileCopyrightText: 2016 Artem Fedoskin <[email protected]>
2 // SPDX-License-Identifier: GPL-2.0-or-later
3 
4 import QtQuick 2.6
5 import QtQuick.Layouts 1.2
6 import QtQuick.Controls 2.0
7 import "../../constants" 1.0
8 import "../../modules"
9 
10 Row {
11  spacing: 5
12  id: ledRow
13  property string deviceName
14  property string propName
15  property string label
16  property string name //Used in Light
17 
18  onDeviceNameChanged: {
19  syncLEDProperty()
20  }
21 
22  onPropNameChanged: {
23  syncLEDProperty()
24  }
25 
26  function syncLEDProperty() {
27  led.color = ClientManagerLite.syncLED(ledRow.deviceName, ledRow.propName)
28  }
29 
30  function syncLEDLight() {
31  led.color = ClientManagerLite.syncLED(ledRow.deviceName, ledRow.propName, ledRow.name)
32  }
33 
34  Connections {
35  target: ClientManagerLite
36  onNewINDILight: {
37  if(ledRow.deviceName == deviceName) {
38  if(ledRow.propName == propName) {
39  ledRow.syncLEDLight() // We update only Lights here
40  }
41  }
42  }
43  }
44 
45  Led {
46  id: led
47  color: "red"
48  anchors.verticalCenter: parent.verticalCenter
49  }
50 
51  KSLabel {
52  text: ledRow.label
53  anchors.verticalCenter: parent.verticalCenter
54  }
55 }
Q_INVOKABLE QString syncLED(const QString &device, const QString &property, const QString &name="")
syncLED
QString label(StandardShortcut id)
QString name(StandardShortcut id)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:57:32 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.