diff --git a/applets/taskmanager/package/contents/ui/Task.qml b/applets/taskmanager/package/contents/ui/Task.qml --- a/applets/taskmanager/package/contents/ui/Task.qml +++ b/applets/taskmanager/package/contents/ui/Task.qml @@ -121,13 +121,68 @@ } } else { pressed = false; + tasks.taskMouseLeft(itemIndex); } if (model.IsWindow === true) { - tasks.windowsHovered(model.LegacyWinIdList, containsMouse); + tasksModel.makeModelIndex(index); } } + + function showToolTip() { + if (containsMouse) { + toolTipDelegate.parentTask = task; + toolTipDelegate.parentIndex = itemIndex; + + toolTipDelegate.appName = Qt.binding(function() { + return model.AppName; + }); + toolTipDelegate.pidParent = Qt.binding(function() { + return model.AppPid; + }); + toolTipDelegate.windows = Qt.binding(function() { + return model.LegacyWinIdList; + }); + toolTipDelegate.isGroup = Qt.binding(function() { + return model.IsGroupParent == true; + }); + toolTipDelegate.icon = Qt.binding(function() { + return model.decoration; + }); + toolTipDelegate.launcherUrl = Qt.binding(function() { + return model.LauncherUrlWithoutIcon; + }); + toolTipDelegate.isLauncher = Qt.binding(function() { + return model.IsLauncher == true; + }); + toolTipDelegate.isMinimizedParent = Qt.binding(function() { + return model.IsMinimized == true; + }); + toolTipDelegate.displayParent = Qt.binding(function() { + return model.display; + }); + toolTipDelegate.genericName = Qt.binding(function() { + return model.GenericName; + }); + toolTipDelegate.virtualDesktopParent = Qt.binding(function() { + return model.VirtualDesktop != undefined ? model.VirtualDesktop : 0; + }); + toolTipDelegate.isOnAllVirtualDesktopsParent = Qt.binding(function() { + return model.IsOnAllVirtualDesktops == true; + }); + toolTipDelegate.activitiesParent = Qt.binding(function() { + return model.Activities; + }); + + toolTipDelegate.smartLauncherCountVisible = Qt.binding(function() { + return plasmoid.configuration.smartLaunchersEnabled && task.smartLauncherItem && task.smartLauncherItem.countVisible; + }); + toolTipDelegate.smartLauncherCount = Qt.binding(function() { + return toolTipDelegate.smartLauncherCountVisible ? task.smartLauncherItem.count : 0; + }); + } + } onPressed: { if (mouse.button == Qt.LeftButton || mouse.button == Qt.MidButton || mouse.button === Qt.BackButton || mouse.button === Qt.ForwardButton) { @@ -274,7 +329,7 @@ Component { id: taskInitComponent - + Timer { id: timer @@ -320,60 +375,14 @@ active: !inPopup && !groupDialog.visible && plasmoid.configuration.showToolTips interactive: true - + autoShowHide: false mainItem: toolTipDelegate - onContainsMouseChanged: { - if (containsMouse) { - toolTipDelegate.parentTask = task; - toolTipDelegate.parentIndex = itemIndex; - - toolTipDelegate.appName = Qt.binding(function() { - return model.AppName; - }); - toolTipDelegate.pidParent = Qt.binding(function() { - return model.AppPid; - }); - toolTipDelegate.windows = Qt.binding(function() { - return model.LegacyWinIdList; - }); - toolTipDelegate.isGroup = Qt.binding(function() { - return model.IsGroupParent == true; - }); - toolTipDelegate.icon = Qt.binding(function() { - return model.decoration; - }); - toolTipDelegate.launcherUrl = Qt.binding(function() { - return model.LauncherUrlWithoutIcon; - }); - toolTipDelegate.isLauncher = Qt.binding(function() { - return model.IsLauncher == true; - }); - toolTipDelegate.isMinimizedParent = Qt.binding(function() { - return model.IsMinimized == true; - }); - toolTipDelegate.displayParent = Qt.binding(function() { - return model.display; - }); - toolTipDelegate.genericName = Qt.binding(function() { - return model.GenericName; - }); - toolTipDelegate.virtualDesktopParent = Qt.binding(function() { - return model.VirtualDesktop != undefined ? model.VirtualDesktop : 0; - }); - toolTipDelegate.isOnAllVirtualDesktopsParent = Qt.binding(function() { - return model.IsOnAllVirtualDesktops == true; - }); - toolTipDelegate.activitiesParent = Qt.binding(function() { - return model.Activities; - }); - - toolTipDelegate.smartLauncherCountVisible = Qt.binding(function() { - return plasmoid.configuration.smartLaunchersEnabled && task.smartLauncherItem && task.smartLauncherItem.countVisible; - }); - toolTipDelegate.smartLauncherCount = Qt.binding(function() { - return toolTipDelegate.smartLauncherCountVisible ? task.smartLauncherItem.count : 0; - }); + onToolTipWindowContainsMouseChanged: { + if (toolTipWindowContainsMouse) { + tasks.taskMouseEntered(itemIndex); + } else { + tasks.taskMouseLeft(itemIndex); } } } diff --git a/applets/taskmanager/package/contents/ui/main.qml b/applets/taskmanager/package/contents/ui/main.qml --- a/applets/taskmanager/package/contents/ui/main.qml +++ b/applets/taskmanager/package/contents/ui/main.qml @@ -36,7 +36,8 @@ property bool vertical: (plasmoid.formFactor == PlasmaCore.Types.Vertical) property bool iconsOnly: (plasmoid.pluginName == "org.kde.plasma.icontasks") - + property QtObject currentToolTipTask: null; + property QtObject futureToolTipTask: null; property QtObject contextMenuComponent: Qt.createComponent("ContextMenu.qml"); Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation @@ -475,6 +476,41 @@ return tasks.contextMenuComponent.createObject(rootTask, initialArgs); } + Timer { + id: toolTipHideTimer + + interval: 300 + repeat: false + + onTriggered: { + currentToolTipTask = futureToolTipTask; + currentToolTipTask.showToolTip(); + } + } + + Timer { + id: ToolTipHideTimer + + interval: 300 + repeat: false + + onTriggered: { + currentToolTipTask.hideToolTip(); + currentToolTipTask = null; + } + } + + function taskMouseEntered(itemIndex) { + var task = taskRepeater.itemAt(itemIndex); + toolTipHideTimer.stop(); + toolTipShowTimer.stop() + + if(task != currentToolTipTask) { + futureToolTipTask = task; + toolTipShowTimer.start(); + } + } + Component.onCompleted: { tasks.requestLayout.connect(layoutTimer.restart); tasks.requestLayout.connect(iconGeometryTimer.restart);