Warning, /plasma/plasma-desktop/applets/taskmanager/package/contents/ui/ToolTipDelegate.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org> 0003 SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org> 0004 SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de> 0005 SPDX-FileCopyrightText: 2017 Roman Gilg <subdiff@gmail.com> 0006 0007 SPDX-License-Identifier: LGPL-2.0-or-later 0008 */ 0009 0010 import QtQuick 2.15 0011 import QtQuick.Layouts 1.15 0012 import QtQuick.Window 2.15 0013 import QtQml.Models 2.15 0014 import org.kde.plasma.plasmoid 2.0 0015 0016 import org.kde.plasma.core as PlasmaCore 0017 import org.kde.plasma.components 3.0 as PlasmaComponents3 0018 import org.kde.kirigami 2.20 as Kirigami 0019 0020 Loader { 0021 id: toolTipDelegate 0022 0023 property Item parentTask 0024 property var rootIndex 0025 0026 property string appName 0027 property int pidParent 0028 property bool isGroup 0029 0030 property var windows 0031 readonly property bool isWin: (windows?.length ?? 0) > 0 0032 0033 property variant icon 0034 property url launcherUrl 0035 property bool isLauncher 0036 property bool isMinimizedParent 0037 0038 // Needed for generateSubtext() 0039 property string displayParent 0040 property string genericName 0041 property var virtualDesktopParent 0042 property bool isOnAllVirtualDesktopsParent 0043 property var activitiesParent 0044 // 0045 property bool smartLauncherCountVisible 0046 property int smartLauncherCount 0047 0048 property bool blockingUpdates: false 0049 0050 readonly property bool isVerticalPanel: Plasmoid.formFactor === PlasmaCore.Types.Vertical 0051 // This number controls the overall size of the window tooltips 0052 readonly property int tooltipInstanceMaximumWidth: Kirigami.Units.gridUnit * 16 0053 0054 // These properties are required to make tooltip interactive when there is a player but no window is present. 0055 readonly property QtObject playerData: mpris2Source.playerForLauncherUrl(launcherUrl, pidParent) 0056 0057 Layout.minimumWidth: implicitWidth 0058 Layout.maximumWidth: Layout.minimumWidth 0059 0060 Layout.minimumHeight: implicitHeight 0061 Layout.maximumHeight: Layout.minimumHeight 0062 0063 LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft 0064 LayoutMirroring.childrenInherit: true 0065 0066 active: !blockingUpdates && rootIndex !== undefined && ((parentTask && parentTask.containsMouse) || Window.visibility !== Window.Hidden) 0067 asynchronous: true 0068 0069 sourceComponent: isGroup ? groupToolTip : singleTooltip 0070 0071 Component { 0072 id: singleTooltip 0073 0074 ToolTipInstance { 0075 submodelIndex: toolTipDelegate.rootIndex 0076 } 0077 } 0078 0079 Component { 0080 id: groupToolTip 0081 0082 PlasmaComponents3.ScrollView { 0083 // 2 * Kirigami.Units.smallSpacing is for the margin of tooltipDialog 0084 implicitWidth: leftPadding + rightPadding + Math.min(Screen.desktopAvailableWidth - 2 * Kirigami.Units.smallSpacing, Math.max(delegateModel.estimatedWidth, contentItem.contentItem.childrenRect.width)) 0085 implicitHeight: bottomPadding + Math.min(Screen.desktopAvailableHeight - 2 * Kirigami.Units.smallSpacing, Math.max(delegateModel.estimatedHeight, contentItem.contentItem.childrenRect.height)) 0086 0087 ListView { 0088 id: groupToolTipListView 0089 0090 model: delegateModel 0091 0092 orientation: isVerticalPanel ? ListView.Vertical : ListView.Horizontal 0093 reuseItems: true 0094 spacing: Kirigami.Units.gridUnit 0095 } 0096 0097 DelegateModel { 0098 id: delegateModel 0099 0100 // On Wayland, a tooltip has a significant resizing process, so estimate the size first. 0101 readonly property real estimatedWidth: (toolTipDelegate.isVerticalPanel ? 1 : count) * (toolTipDelegate.tooltipInstanceMaximumWidth + Kirigami.Units.gridUnit) - Kirigami.Units.gridUnit 0102 readonly property real estimatedHeight: (toolTipDelegate.isVerticalPanel ? count : 1) * (toolTipDelegate.tooltipInstanceMaximumWidth / 2 + Kirigami.Units.gridUnit) - Kirigami.Units.gridUnit 0103 0104 model: tasksModel 0105 0106 rootIndex: toolTipDelegate.rootIndex 0107 onRootIndexChanged: groupToolTipListView.positionViewAtBeginning() // Fix a visual glitch (when the mouse moves from a tooltip with a moved scrollbar to another tooltip without a scrollbar) 0108 0109 delegate: ToolTipInstance { 0110 submodelIndex: tasksModel.makeModelIndex(toolTipDelegate.rootIndex.row, index) 0111 } 0112 } 0113 } 0114 } 0115 }