File 2002-tooltip.patch of Package plasma6-systemmonitor
diff --git a/src/faces/processtable/contents/ui/ProcessTableView.qml b/src/faces/processtable/contents/ui/ProcessTableView.qml
index 5f6504f746dd0366e2fa50c251136237e8176cc8..bcea107f4f8bb7037be47e3097b7a313f590b2d1 100644
--- a/src/faces/processtable/contents/ui/ProcessTableView.qml
+++ b/src/faces/processtable/contents/ui/ProcessTableView.qml
@@ -176,6 +176,7 @@ Table.BaseTableView {
valueSources: model.cachedComponent != undefined ? model.cachedComponent : []
maximum: rowFilter.data(treeView.index(model.row, model.column), Process.ProcessDataModel.Maximum)
text: Formatter.Formatter.formatValue(parseInt(model.Value) / model.Maximum * 100, model.Unit)
+ toolTip: model.ScaledToolTipRole
}
}
@@ -183,6 +184,7 @@ Table.BaseTableView {
roleValue: "textScaled"
Table.TextCellDelegate {
text: Formatter.Formatter.formatValue(parseInt(model.Value) / model.Maximum * 100, model.Unit)
+ toolTip: model.ScaledToolTipRole
}
}
DelegateChoice { Table.TextCellDelegate{} }
diff --git a/src/table/BaseCellDelegate.qml b/src/table/BaseCellDelegate.qml
index 0bfe686990b361ca319ed093adb29a34add85c51..065bd2241b7b860467bfbfcfc33a914a6351d549 100644
--- a/src/table/BaseCellDelegate.qml
+++ b/src/table/BaseCellDelegate.qml
@@ -12,10 +12,12 @@ import QtQml.Models
import org.kde.kirigami as Kirigami
import org.kde.ksysguard.table as Table
-TreeViewDelegate
-{
+TreeViewDelegate {
id: root
+ property string toolTip: model.toolTip ?? ""
+
+ hoverEnabled: true
text: model.display
// Important: Don't remove this until QTBUG-84858 is resolved properly.
@@ -28,4 +30,12 @@ TreeViewDelegate
background: Rectangle {
color: (row % 2 == 0 || selected) ? Kirigami.Theme.backgroundColor : Kirigami.Theme.alternateBackgroundColor
}
+
+ ToolTip {
+ closePolicy: Popup.CloseOnReleaseOutside
+ text: root.toolTip || root.text
+ visible: root.hovered && text.length > 0 && (root.toolTip.length > 0 || (root.contentItem.truncated ?? false))
+ }
+
+ ToolTip.visible: false
}
diff --git a/src/table/FirstCellDelegate.qml b/src/table/FirstCellDelegate.qml
index d68088e6c22dd3467e3d9d028d83d03dd733226f..24ba331390289ac884c15b5aebcb601045c69efc 100644
--- a/src/table/FirstCellDelegate.qml
+++ b/src/table/FirstCellDelegate.qml
@@ -29,10 +29,6 @@ BaseCellDelegate {
contentItem: RowLayout {
id: row
- // This is so the TreeViewDelegate from the style can detect when to show a tooltip.
- // Since our label is one level under, it doesn't have access to `truncated` normally.
- property alias truncated: label.truncated
-
Kirigami.Icon {
Layout.preferredWidth: delegate.iconSize
Layout.preferredHeight: Layout.preferredWidth
diff --git a/src/table/LineChartCellDelegate.qml b/src/table/LineChartCellDelegate.qml
index 6662be86a136d183adbc5a6d9a63646adfd91f73..87bd9a482188e061623a6b333054908483704179 100644
--- a/src/table/LineChartCellDelegate.qml
+++ b/src/table/LineChartCellDelegate.qml
@@ -60,9 +60,5 @@ BaseCellDelegate {
elide: Text.ElideRight
}
}
-
- ToolTip.text: delegate.text
- ToolTip.delay: Kirigami.Units.toolTipDelay
- ToolTip.visible: delegate.hovered && label.truncated
}