Warning, /plasma/qqc2-breeze-style/style/qtquickcontrols/SwipeDelegate.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.Controls 2.15 as Controls
0007 import QtQuick.Templates 2.15 as T
0008 import org.kde.kirigami 2.19 as Kirigami
0009 
0010 import "impl" as Impl
0011 
0012 T.SwipeDelegate {
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 (contentItem.hasLabel && display != T.AbstractButton.IconOnly) { // False if contentItem has been replaced
0034             return Impl.Units.mediumHorizontalPadding
0035         } else {
0036             return control.horizontalPadding
0037         }
0038     }
0039 
0040     spacing: Kirigami.Units.mediumSpacing
0041 
0042     icon.width: Kirigami.Units.iconSizes.sizeForLabels
0043     icon.height: Kirigami.Units.iconSizes.sizeForLabels
0044 
0045     Kirigami.Theme.colorSet: control.down || control.highlighted ? Kirigami.Theme.Button : -1
0046     Kirigami.Theme.inherit: !background || !background.visible && !(control.highlighted || control.down)
0047 
0048     contentItem:Impl.IconLabelContent {
0049         control: control
0050         text: control.text
0051         alignment: Qt.AlignLeft | Qt.AlignVCenter
0052         //color: (control.pressed && !control.checked && !control.sectionDelegate) ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor
0053     }
0054 
0055     background: Impl.DelegateBackground {
0056         control: control
0057     }
0058 
0059     clip: true
0060     swipe.transition: Transition {
0061         SmoothedAnimation {
0062             velocity: 3
0063             easing.type: Easing.InOutCubic
0064         }
0065     }
0066 }