Warning, /plasma/qqc2-breeze-style/style/qtquickcontrols/ItemDelegate.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
0006 import QtQuick.Templates as T
0007 import QtQuick.Controls as Controls
0008 import org.kde.kirigami as Kirigami
0009 
0010 import org.kde.breeze.impl as Impl
0011 
0012 T.ItemDelegate {
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 
0024     leftPadding: {
0025         if ((!contentItem.hasIcon && contentItem.textBesideIcon) // False if contentItem has been replaced
0026             || display == T.AbstractButton.TextOnly
0027             || display == T.AbstractButton.TextUnderIcon) {
0028             return Impl.Units.mediumHorizontalPadding
0029         } else {
0030             return control.horizontalPadding
0031         }
0032     }
0033     rightPadding: {
0034         if (contentItem.hasLabel && display != T.AbstractButton.IconOnly) { // False if contentItem has been replaced
0035             return Impl.Units.mediumHorizontalPadding
0036         } else {
0037             return control.horizontalPadding
0038         }
0039     }
0040 
0041     spacing: Kirigami.Units.mediumSpacing
0042 
0043     icon.width: Kirigami.Units.iconSizes.sizeForLabels
0044     icon.height: Kirigami.Units.iconSizes.sizeForLabels
0045 
0046     contentItem: Impl.IconLabelContent {
0047         control: control
0048         alignment: Qt.AlignLeft | Qt.AlignVCenter
0049     }
0050 
0051     background: Impl.DelegateBackground {
0052         control: control
0053     }
0054 }