Warning, /plasma/plasma-bigscreen/kcms/bigscreen-settings/ui/delegates/LocalSettingDelegate.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2019 Aditya Mehra <aix.m@outlook.com>
0003     SPDX-FileCopyrightText: 2019 Marco Martin <mart@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 import QtQuick 2.14
0009 import QtQuick.Layouts 1.14
0010 import QtQuick.Controls 2.14
0011 import org.kde.plasma.components 3.0 as PlasmaComponents
0012 import org.kde.kirigami as Kirigami
0013 import org.kde.mycroft.bigscreen 1.0 as BigScreen
0014 import Qt5Compat.GraphicalEffects
0015 
0016 BigScreen.AbstractDelegate {
0017     id: delegate
0018     property bool isChecked
0019     property alias name: textName.text
0020     property string customType
0021 
0022     highlighted: activeFocus
0023 
0024     onIsCheckedChanged: {
0025         setOption(customType, isChecked)
0026     }
0027 
0028     onFocusChanged: {
0029         if(focus){
0030             delegate.forceActiveFocus()
0031         }
0032     }
0033 
0034     Behavior on implicitWidth {
0035         NumberAnimation {
0036             duration: Kirigami.Units.longDuration
0037             easing.type: Easing.InOutQuad
0038         }
0039     }
0040 
0041     contentItem: RowLayout {
0042         id: localItem
0043 
0044         PlasmaComponents.Label {
0045             id: textName
0046             elide: Text.ElideRight
0047             wrapMode: Text.WordWrap
0048             horizontalAlignment: Text.AlignHCenter
0049             maximumLineCount: 2
0050             color: Kirigami.Theme.textColor
0051             textFormat: Text.PlainText
0052         }
0053 
0054         Kirigami.Icon {
0055             Layout.preferredWidth: Kirigami.Units.iconSizes.smallMedium
0056             Layout.preferredHeight: width
0057             enabled: isChecked
0058             opacity: enabled ? 1 : 0.25
0059             source: Qt.resolvedUrl("../images/green-tick-thick.svg")
0060         }
0061     }
0062 
0063     onClicked: {
0064         isChecked = !isChecked ? 1 : 0
0065     }
0066 }