Warning, /plasma/qqc2-breeze-style/style/qtquickcontrols/CheckDelegate.qml is written in an unsupported language. File is not indexed.

0001 /* SPDX-FileCopyrightText: 2020 Noah Davis <noahadvs@gmail.com>
0002  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0003  */
0004 
0005 import QtQuick 2.15
0006 import QtQuick.Templates 2.15 as T
0007 import QtQuick.Controls 2.15 as Controls
0008 import org.kde.kirigami 2.19 as Kirigami
0009 
0010 import "impl" as Impl
0011 
0012 T.CheckDelegate {
0013     id: control
0014 
0015     implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
0016                             implicitContentWidth + leftPadding + rightPadding,
0017                             implicitIndicatorWidth + leftPadding + rightPadding)
0018     implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
0019                              implicitContentHeight + topPadding + bottomPadding,
0020                              implicitIndicatorHeight + topPadding + bottomPadding)
0021 
0022     padding: Kirigami.Units.mediumSpacing
0023     leftPadding: {
0024         if ((!contentItem.hasIcon && contentItem.textBesideIcon) // False if contentItem has been replaced
0025             || display == T.AbstractButton.TextOnly
0026             || display == T.AbstractButton.TextUnderIcon) {
0027             return Impl.Units.mediumHorizontalPadding
0028         } else {
0029             return control.horizontalPadding
0030         }
0031     }
0032     rightPadding: {
0033         if (!control.indicator.visible
0034             && contentItem.hasLabel
0035             && display != T.AbstractButton.IconOnly) { // False if contentItem has been replaced
0036             return Impl.Units.mediumHorizontalPadding
0037         } else {
0038             return control.horizontalPadding
0039         }
0040     }
0041 
0042     spacing: Kirigami.Units.mediumSpacing
0043 
0044     icon.width: Kirigami.Units.iconSizes.sizeForLabels
0045     icon.height: Kirigami.Units.iconSizes.sizeForLabels
0046 
0047     Kirigami.Theme.colorSet: control.down || control.highlighted ? Kirigami.Theme.Button : -1
0048     Kirigami.Theme.inherit: !background || !background.visible && !(control.highlighted || control.down)
0049 
0050     contentItem: Impl.IconLabelContent {
0051         control: control
0052         alignment: Qt.AlignLeft | Qt.AlignVCenter
0053         //color: (control.pressed && !control.checked && !control.sectionDelegate) ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor
0054     }
0055 
0056     indicator: Impl.CheckIndicator {
0057         control: control
0058         mirrored: !control.mirrored
0059     }
0060 
0061     background: Impl.DelegateBackground {
0062         control: control
0063     }
0064 }