/*SPDX-FileCopyrightText: 2013 Sebastian KΓΌgler <sebas@kde.org>SPDX-FileCopyrightText: 2014 Martin GrΓ€Γlin <mgraesslin@kde.org>SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de>SPDX-FileCopyrightText: 2017 Roman Gilg <subdiff@gmail.com>SPDX-License-Identifier: LGPL-2.0-or-later*/import QtQuick 2.15import QtQuick.Layouts 1.1import QtQuick.Window 2.0import QtQml.Models 2.2import org.kde.plasma.core 2.0 as PlasmaCoreimport org.kde.plasma.components 3.0 as PlasmaComponents3Loader {id: toolTipDelegateproperty Item parentTaskproperty var rootIndex// hasRootIndex is needed to avoid unnecessary reevaluation of model property in DelegateModel,// because !!toolTipDelegate.rootIndex will not work as expected.readonly property bool hasRootIndex: !!rootIndexproperty string appNameproperty int pidParentproperty bool isGroupproperty var windowsreadonly property bool isWin: windows !== undefinedproperty variant iconproperty url launcherUrlproperty bool isLauncherproperty bool isMinimizedParent// Needed for generateSubtext()property string displayParentproperty string genericNameproperty var virtualDesktopParentproperty bool isOnAllVirtualDesktopsParentproperty var activitiesParent//property bool smartLauncherCountVisibleproperty int smartLauncherCountreadonly property bool isVerticalPanel: plasmoid.formFactor === PlasmaCore.Types.Vertical// These properties are required to make tooltip interactive when there is a player but no window is present.readonly property string mprisSourceName: mpris2Source.sourceNameForLauncherUrl(launcherUrl, pidParent)readonly property var playerData: mprisSourceName != "" ? mpris2Source.data[mprisSourceName] : 0readonly property bool hasPlayer: !!mprisSourceName && !!playerDataBinding on Layout.minimumWidth {value: implicitWidthdelayed: true // Prevent early hide of tooltip (BUG439522)}Layout.maximumWidth: Layout.minimumWidthBinding on Layout.minimumHeight {value: implicitHeightdelayed: true // Prevent early hide of tooltip (BUG439522)}Layout.maximumHeight: Layout.minimumHeightLayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeftLayoutMirroring.childrenInherit: trueproperty int textWidth: PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).width * 20active: rootIndex !== undefinedasynchronous: truesourceComponent: isGroup ? groupToolTip : singleTooltipComponent {id: singleTooltipToolTipInstance {submodelIndex: toolTipDelegate.rootIndex}}Component {id: groupToolTipPlasmaComponents3.ScrollView {// 2 * PlasmaCore.Units.smallSpacing is for the margin of tooltipDialogimplicitWidth: leftPadding + rightPadding + Math.min(Screen.desktopAvailableWidth - 2 * PlasmaCore.Units.smallSpacing, contentItem.contentItem.childrenRect.width)implicitHeight: bottomPadding + Math.min(Screen.desktopAvailableHeight - 2 * PlasmaCore.Units.smallSpacing, contentItem.contentItem.childrenRect.height)// HACK: workaround for https://bugreports.qt.io/browse/QTBUG-83890PlasmaComponents3.ScrollBar.horizontal.policy: isVerticalPanel ? PlasmaComponents3.ScrollBar.AlwaysOff : PlasmaComponents3.ScrollBar.AsNeededPlasmaComponents3.ScrollBar.vertical.policy: isVerticalPanel ? PlasmaComponents3.ScrollBar.AsNeeded : PlasmaComponents3.ScrollBar.AlwaysOffListView {id: groupToolTipListViewmodel: DelegateModel {model: toolTipDelegate.hasRootIndex ? tasksModel : nullrootIndex: toolTipDelegate.rootIndexonRootIndexChanged: groupToolTipListView.positionViewAtBeginning() // Fix a visual glitch (when the mouse moves from a tooltip with a moved scrollbar to another tooltip without a scrollbar)delegate: ToolTipInstance {submodelIndex: tasksModel.makeModelIndex(toolTipDelegate.rootIndex.row, index)}}orientation: isVerticalPanel ? ListView.Vertical : ListView.HorizontalreuseItems: truespacing: PlasmaCore.Units.largeSpacing}}}}