Changeset View
Changeset View
Standalone View
Standalone View
applets/taskmanager/package/contents/ui/ToolTipDelegate.qml
Show All 27 Lines | |||||
28 | import org.kde.plasma.core 2.0 as PlasmaCore | 28 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
29 | import org.kde.plasma.components 2.0 as PlasmaComponents | 29 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
30 | import org.kde.plasma.extras 2.0 as PlasmaExtras | 30 | import org.kde.plasma.extras 2.0 as PlasmaExtras | ||
31 | import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons | 31 | import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons | ||
32 | 32 | | |||
33 | import org.kde.taskmanager 0.1 as TaskManager | 33 | import org.kde.taskmanager 0.1 as TaskManager | ||
34 | 34 | | |||
35 | PlasmaExtras.ScrollArea { | 35 | PlasmaExtras.ScrollArea { | ||
36 | id: toolTipDelegate | ||||
37 | | ||||
36 | property Item parentTask | 38 | property Item parentTask | ||
37 | property int parentIndex | 39 | property var rootIndex | ||
38 | 40 | | |||
39 | property string appName | 41 | property string appName | ||
40 | property int pidParent | 42 | property int pidParent | ||
41 | property bool isGroup | 43 | property bool isGroup | ||
42 | 44 | | |||
43 | property var windows | 45 | property var windows | ||
44 | readonly property bool isWin: windows !== undefined | 46 | readonly property bool isWin: windows !== undefined | ||
45 | 47 | | |||
Show All 29 Lines | |||||
75 | horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff | 77 | horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff | ||
76 | 78 | | |||
77 | Component.onCompleted: { | 79 | Component.onCompleted: { | ||
78 | flickableItem.interactive = Qt.binding(function() { | 80 | flickableItem.interactive = Qt.binding(function() { | ||
79 | return isVerticalPanel ? contentItem.height > viewport.height : contentItem.width > viewport.width | 81 | return isVerticalPanel ? contentItem.height > viewport.height : contentItem.width > viewport.width | ||
80 | }); | 82 | }); | ||
81 | } | 83 | } | ||
82 | 84 | | |||
83 | Item { | 85 | Loader { | ||
84 | id: contentItem | 86 | id: contentItem | ||
85 | width: childrenRect.width | 87 | | ||
86 | height: childrenRect.height | 88 | active: toolTipDelegate.rootIndex != undefined | ||
89 | asynchronous: true | ||||
90 | | ||||
91 | sourceComponent: isGroup ? groupToolTip : singleTooltip | ||||
92 | | ||||
93 | Component { | ||||
94 | id: singleTooltip | ||||
87 | 95 | | |||
88 | ToolTipInstance { | 96 | ToolTipInstance { | ||
89 | visible: !isGroup | 97 | submodelIndex: toolTipDelegate.rootIndex | ||
98 | } | ||||
90 | } | 99 | } | ||
91 | 100 | | |||
101 | Component { | ||||
102 | id: groupToolTip | ||||
103 | | ||||
92 | Grid { | 104 | Grid { | ||
93 | rows: !isVerticalPanel | 105 | rows: !isVerticalPanel | ||
94 | columns: isVerticalPanel | 106 | columns: isVerticalPanel | ||
95 | flow: isVerticalPanel ? Grid.TopToBottom : Grid.LeftToRight | 107 | flow: isVerticalPanel ? Grid.TopToBottom : Grid.LeftToRight | ||
96 | spacing: units.largeSpacing | 108 | spacing: units.largeSpacing | ||
97 | 109 | | |||
98 | visible: isGroup | | |||
99 | | ||||
100 | Repeater { | 110 | Repeater { | ||
101 | id: groupRepeater | 111 | id: groupRepeater | ||
102 | model: DelegateModel { | 112 | model: DelegateModel { | ||
103 | model: tasksModel | 113 | model: toolTipDelegate.rootIndex ? tasksModel : null | ||
104 | rootIndex: tasksModel.makeModelIndex(parentIndex, -1) | 114 | | ||
105 | delegate: ToolTipInstance {} | 115 | rootIndex: toolTipDelegate.rootIndex | ||
116 | | ||||
117 | delegate: ToolTipInstance { | ||||
118 | submodelIndex: tasksModel.makeModelIndex(toolTipDelegate.rootIndex.row, index) | ||||
119 | } | ||||
120 | } | ||||
106 | } | 121 | } | ||
107 | } | 122 | } | ||
108 | } | 123 | } | ||
109 | } | 124 | } | ||
110 | } | 125 | } |