Warning, /plasma/qqc2-breeze-style/style/qtquickcontrols/Menu.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2017 Marco Martin <mart@kde.org> 0003 SPDX-FileCopyrightText: 2017 The Qt Company Ltd. 0004 SPDX-FileCopyrightText: 2020 Noah Davis <noahadvs@gmail.com> 0005 SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later 0006 */ 0007 0008 0009 import QtQuick 2.15 0010 import QtQuick.Layouts 1.12 0011 import QtQuick.Window 2.15 0012 import QtQuick.Controls 2.15 as Controls 0013 import QtQuick.Controls.impl 2.15 0014 import QtQuick.Templates 2.15 as T 0015 import org.kde.kirigami 2.19 as Kirigami 0016 0017 import "impl" as Impl 0018 0019 T.Menu { 0020 id: control 0021 0022 property bool __hasIndicators: false 0023 property bool __hasIcons: false 0024 property bool __hasArrows: false 0025 0026 palette: Kirigami.Theme.palette 0027 implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, 0028 contentWidth + leftPadding + rightPadding) 0029 implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, 0030 contentHeight + topPadding + bottomPadding) 0031 padding: Kirigami.Units.smallSpacing 0032 margins: 0 0033 overlap: background && background.hasOwnProperty("border") ? background.border.width : 0 0034 0035 // The default contentItem is a ListView, which has its own contentItem property, 0036 // so delegates will be created as children of control.contentItem.contentItem 0037 delegate: Controls.MenuItem {} 0038 0039 contentItem: ListView { 0040 implicitHeight: contentHeight 0041 implicitWidth: contentWidth 0042 model: control.contentModel 0043 highlightMoveDuration: Kirigami.Units.shortDuration 0044 highlightMoveVelocity: 800 0045 highlight: Impl.ListViewHighlight { 0046 currentIndex: control.currentIndex 0047 count: control.count 0048 alwaysCurveCorners: true 0049 } 0050 // For some reason, `keyNavigationEnabled: true` isn't needed and 0051 // using it causes separators and disabled items to be highlighted 0052 keyNavigationWraps: true 0053 0054 // Makes it so you can't drag/flick the list view around unless the menu is taller than the window 0055 interactive: Window.window ? contentHeight + control.topPadding + control.bottomPadding > Window.window.height : false 0056 clip: interactive // Only needed when the ListView can be dragged/flicked 0057 currentIndex: control.currentIndex || 0 0058 0059 ScrollBar.vertical: Controls.ScrollBar {} 0060 } 0061 0062 enter: Transition { 0063 ParallelAnimation { 0064 NumberAnimation { 0065 property: "opacity" 0066 from: 0 0067 to: 1 0068 easing.type: Easing.OutCubic 0069 duration: Kirigami.Units.shortDuration 0070 } 0071 } 0072 } 0073 0074 exit: Transition { 0075 ParallelAnimation { 0076 NumberAnimation { 0077 property: "opacity" 0078 from: 1 0079 to: 0 0080 easing.type: Easing.InCubic 0081 duration: Kirigami.Units.shortDuration 0082 } 0083 } 0084 } 0085 0086 background: Rectangle { 0087 radius: Impl.Units.smallRadius 0088 implicitHeight: Impl.Units.mediumControlHeight 0089 implicitWidth: Kirigami.Units.gridUnit * 15 0090 color: Kirigami.Theme.backgroundColor 0091 0092 border { 0093 color: Kirigami.Theme.separatorColor 0094 width: Impl.Units.smallBorder 0095 } 0096 0097 Impl.LargeShadow { 0098 radius: parent.radius 0099 } 0100 } 0101 }