Kstars

KSLed.qml
1// SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4import QtQuick 2.6
5import QtQuick.Layouts 1.2
6import QtQuick.Controls 2.0
7import "../../constants" 1.0
8import "../../modules"
9
10Row {
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 name(StandardAction id)
QString label(StandardShortcut id)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.