Warning, /plasma/qqc2-breeze-style/style/impl/IconLabelShortcutContent.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.Layouts
0007 import QtQuick.Templates as T
0008 import org.kde.kirigami as Kirigami
0009 
0010 import "." as Impl
0011 
0012 IconLabelContent {
0013     id: root
0014 
0015     Loader {
0016         id: shortcutLabelLoader
0017         // rightPadding is actually left side padding when mirrored == true
0018         x: root.mirrored ? root.rightPadding : root.width - width - root.rightPadding
0019         y: root.labelRect.y
0020         width: Math.min(implicitWidth, Math.max(0, root.width - root.implicitWidth - root.spacing))
0021         active: Qt.styleHints.showShortcutsInContextMenus
0022                 && control.action
0023                 && control.action.hasOwnProperty("shortcut")
0024                 && control.action.shortcut !== undefined
0025                 && !root.iconOnly
0026         sourceComponent: Component {
0027             T.Label {
0028                 id: shortcutLabel
0029                 anchors {
0030                     left: parent.left
0031                     right: parent.right
0032                     top: parent.top
0033                 }
0034 
0035                 Shortcut {
0036                     id: itemShortcut
0037                     sequence: (shortcutLabel.visible && control.action !== null) ? control.action.shortcut : ""
0038                 }
0039 
0040                 text: itemShortcut.nativeText
0041                 font: root.font
0042                 color: root.color
0043                 horizontalAlignment: Text.AlignRight
0044                 verticalAlignment: Text.AlignVCenter
0045             }
0046         }
0047     }
0048 }