Warning, /plasma/latte-dock/declarativeimports/components/HeaderSwitch.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2019 Michail Vourlakos <mvourlakos@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 import QtQuick 2.7 0007 import QtGraphicalEffects 1.0 0008 import QtQuick.Controls 1.4 0009 import QtQuick.Layouts 1.3 0010 0011 import org.kde.plasma.core 2.0 as PlasmaCore 0012 import org.kde.plasma.components 2.0 as PlasmaComponents 0013 0014 import org.kde.plasma.plasmoid 2.0 0015 0016 import "." as LatteExtraControls 0017 0018 import "private" as Private 0019 0020 Item { 0021 id: item 0022 0023 Layout.rightMargin: { 0024 if (level === 1) { 0025 return Qt.application.layoutDirection === Qt.RightToLeft ? 0 : 2 * units.smallSpacing 0026 } 0027 0028 return 0; 0029 } 0030 Layout.leftMargin: { 0031 if (level === 1) { 0032 return Qt.application.layoutDirection === Qt.RightToLeft ? 2 * units.smallSpacing : 0 0033 } 0034 0035 return 0; 0036 } 0037 0038 property int level:1 0039 property bool checked: false 0040 property bool isFirstSubCategory: false 0041 0042 readonly property int implicitWidth: row.width 0043 0044 readonly property int implicitHeight: { 0045 if (level === 1) { 0046 return Math.max(headerText.implicitHeight, itemSwitch.implicitHeight); 0047 } else if (level === 2) { 0048 return Math.max(subHeaderText.implicitHeight, itemSwitch.implicitHeight) 0049 } 0050 0051 return Math.max(labelText.implicitHeight, itemSwitch.implicitHeight); 0052 } 0053 0054 property string text:"" 0055 property string tooltip:"" 0056 0057 signal pressed(); 0058 0059 Item { 0060 id: row 0061 width: parent.width 0062 height: textElement.height 0063 anchors.verticalCenter: parent.verticalCenter 0064 0065 RowLayout { 0066 id: textElement 0067 anchors.left: level !== 2 ? parent.left : undefined 0068 anchors.horizontalCenter: level === 2 ? parent.horizontalCenter : undefined 0069 anchors.verticalCenter: parent.verticalCenter 0070 0071 LatteExtraControls.Header { 0072 id: headerText 0073 text: item.text 0074 enabled: item.checked && item.enabled 0075 visible: level === 1 0076 } 0077 0078 LatteExtraControls.SubHeader { 0079 id: subHeaderText 0080 text: item.text 0081 enabled: item.checked && item.enabled 0082 visible: level === 2 0083 isFirstSubCategory: item.isFirstSubCategory 0084 } 0085 0086 PlasmaComponents.Label { 0087 id: labelText 0088 text: item.text 0089 enabled: item.checked && item.enabled 0090 visible: level > 2 0091 } 0092 } 0093 0094 PlasmaComponents.Button { 0095 //tooltip ghost 0096 anchors.fill: textElement 0097 tooltip: item.tooltip 0098 opacity: 0 0099 onPressedChanged: { 0100 if (pressed) { 0101 item.pressed(); 0102 } 0103 } 0104 } 0105 } 0106 0107 Switch { 0108 id: itemSwitch 0109 anchors.verticalCenter: row.verticalCenter 0110 anchors.right: row.right 0111 checked: item.checked 0112 enabled: item.enabled 0113 0114 style: Private.SwitchStyle {} 0115 0116 PlasmaComponents.Button { 0117 //tooltip ghost 0118 anchors.fill: parent 0119 tooltip: item.tooltip 0120 opacity: 0 0121 onPressedChanged: { 0122 if (pressed) { 0123 item.pressed(); 0124 } 0125 } 0126 } 0127 } 0128 }