Warning, /frameworks/kcmutils/src/qml/components/SettingStateBinding.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2020 Kevin Ottens <kevin.ottens@enioka.com> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import org.kde.kcmutils as KCM 0009 import org.kde.kcmutils.private as KCMP 0010 0011 /** 0012 * SettingStateBinding automatically impacts the representation 0013 * of an item based on the state of a setting. It will disable 0014 * the item if the setting is immutable and use a visual indicator 0015 * for the state of the setting. 0016 * 0017 * This is a higher level convenience wrapper for KCM.SettingStateProxy 0018 * and KCM.SettingStateIndicator. 0019 * 0020 * @since 6.0 0021 */ 0022 Loader { 0023 id: root 0024 0025 active: typeof kcm !== "undefined" && root.target !== null 0026 0027 /** 0028 * target: Item 0029 * The graphical element whose state we want to manage based on a setting 0030 * If target is not set, it will try to find the visual parent item 0031 */ 0032 property Item target: root.parent 0033 0034 /** 0035 * configObject: KCoreConfigSkeleton 0036 * The config object which will be monitored for setting state changes 0037 */ 0038 property alias configObject: settingState.configObject 0039 0040 /** 0041 * settingName: string 0042 * The name of the setting in the config object to be monitored 0043 */ 0044 property alias settingName: settingState.settingName 0045 0046 /** 0047 * extraEnabledConditions: bool 0048 * SettingStateBinding will manage the enabled property of the target 0049 * based on the immutability state of the setting it represents. But, 0050 * sometimes that enabled state needs to bind to other properties as 0051 * well to be computed properly. This extra condition will thus be 0052 * combined with the immutability state of the setting to determine 0053 * the effective enabled state of the target. 0054 */ 0055 property bool extraEnabledConditions: true 0056 0057 /** 0058 * nonDefaultHighlightVisible: bool 0059 * Expose whether the non default highlight is visible. 0060 * Allow one to implement highlight with custom items. 0061 */ 0062 readonly property bool nonDefaultHighlightVisible: root.active && root.item.highlight && kcm.defaultsIndicatorsVisible 0063 0064 Binding { 0065 when: root.active 0066 target: root.target 0067 property: "enabled" 0068 value: extraEnabledConditions && !settingState.immutable 0069 } 0070 0071 KCM.SettingStateProxy { 0072 id: settingState 0073 } 0074 0075 sourceComponent: KCMP.SettingHighlighterPrivate { 0076 id: helper 0077 defaultIndicatorVisible: kcm.defaultsIndicatorsVisible 0078 highlight: !settingState.defaulted 0079 target: root.target 0080 } 0081 }