Commit 1e218b40 authored by Eike Hein's avatar Eike Hein

Fix tooltip woes

Summary:
Users have reported a number of bugs against TM tooltips, e.g. initially
coming up with crazy sizes, or showing window duplicates. This all comes
down to a race conditions causing stale data and ugly code that's using
visible props to swap between two alternate UI implementations instead
of doing clean conditional loading.

With this cleanup patch the problems should be gone, as well as various
ReferenceErrors spewed onto the tty.

BUG:382571
BUG:385947
BUG:389469
BUG:388749

Reviewers: broulik, davidedmundson, romangg

Reviewed By: davidedmundson

Subscribers: rikmills, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D13602
parent 1ab6ae9a
......@@ -326,7 +326,7 @@ MouseArea {
onContainsMouseChanged: {
if (containsMouse) {
toolTipDelegate.parentTask = task;
toolTipDelegate.parentIndex = itemIndex;
toolTipDelegate.rootIndex = tasksModel.makeModelIndex(itemIndex, -1);
toolTipDelegate.appName = Qt.binding(function() {
return model.AppName;
......
......@@ -33,8 +33,10 @@ import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
import org.kde.taskmanager 0.1 as TaskManager
PlasmaExtras.ScrollArea {
id: toolTipDelegate
property Item parentTask
property int parentIndex
property var rootIndex
property string appName
property int pidParent
......@@ -80,29 +82,42 @@ PlasmaExtras.ScrollArea {
});
}
Item {
Loader {
id: contentItem
width: childrenRect.width
height: childrenRect.height
ToolTipInstance {
visible: !isGroup
active: toolTipDelegate.rootIndex != undefined
asynchronous: true
sourceComponent: isGroup ? groupToolTip : singleTooltip
Component {
id: singleTooltip
ToolTipInstance {
submodelIndex: toolTipDelegate.rootIndex
}
}
Grid {
rows: !isVerticalPanel
columns: isVerticalPanel
flow: isVerticalPanel ? Grid.TopToBottom : Grid.LeftToRight
spacing: units.largeSpacing
Component {
id: groupToolTip
Grid {
rows: !isVerticalPanel
columns: isVerticalPanel
flow: isVerticalPanel ? Grid.TopToBottom : Grid.LeftToRight
spacing: units.largeSpacing
Repeater {
id: groupRepeater
model: DelegateModel {
model: toolTipDelegate.rootIndex ? tasksModel : null
visible: isGroup
rootIndex: toolTipDelegate.rootIndex
Repeater {
id: groupRepeater
model: DelegateModel {
model: tasksModel
rootIndex: tasksModel.makeModelIndex(parentIndex, -1)
delegate: ToolTipInstance {}
delegate: ToolTipInstance {
submodelIndex: tasksModel.makeModelIndex(toolTipDelegate.rootIndex.row, index)
}
}
}
}
}
......
......@@ -33,7 +33,7 @@ import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
import org.kde.taskmanager 0.1 as TaskManager
Column {
property var submodelIndex: tasksModel.makeModelIndex(parentIndex, isGroup ? index : -1)
property var submodelIndex
property int flatIndex: isGroup && index != undefined ? index : 0
spacing: units.smallSpacing
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment