Plot tooltip: show cursor timestamp (HH:MM:SS) above trace values

Add a small dimmed timestamp label at the top of PlotTooltip.
set_values() now accepts ts_str as first argument; _on_mouse_move
formats the cursor x-position as HH:MM:SS and passes it through.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-26 17:05:13 +02:00
co-authored by Claude Sonnet 4.6
parent 55719010da
commit e6c9f7d687
+7 -2
View File
@@ -420,13 +420,17 @@ class PlotTooltip(QWidget):
lay = QVBoxLayout(self)
lay.setContentsMargins(6, 4, 6, 4)
lay.setSpacing(1)
self._ts_label = QLabel()
self._ts_label.setStyleSheet("color: #888899; font-size: 9px;")
lay.addWidget(self._ts_label)
self._labels: list[QLabel] = []
self.hide()
def set_values(self, entries: list):
def set_values(self, ts_str: str, entries: list):
if not entries:
self.hide()
return
self._ts_label.setText(ts_str)
while len(self._labels) < len(entries):
lbl = QLabel()
lbl.setTextFormat(Qt.RichText)
@@ -790,7 +794,8 @@ class PlotTab(QWidget):
val_str = (f"{y:g} {unit}").strip()
entries.append((self.COLORS[j], _trace_label(key), val_str))
tt.set_values(entries)
ts_str = datetime.fromtimestamp(x).strftime("%H:%M:%S")
tt.set_values(ts_str, entries)
if entries:
wpos = pw.mapFromScene(pos)
tx = int(wpos.x()) + 14