| 664 | } |
| 665 | |
| 666 | void CurveTreeView::applyVisibleValuesToSubtree(QTreeWidgetItem* item, int viewport_height) { |
| 667 | if (item->childCount() != 0) { |
| 668 | for (int i = 0; i < item->childCount(); ++i) { |
| 669 | applyVisibleValuesToSubtree(item->child(i), viewport_height); |
| 670 | } |
| 671 | return; |
| 672 | } |
| 673 | const QString key = catalogKeyForItem(item); |
| 674 | if (key.isEmpty()) { |
| 675 | return; // group placeholder / unkeyed row |
| 676 | } |
| 677 | const QRect rect = visualItemRect(item); |
| 678 | if (rect.isNull() || rect.bottom() < 0 || rect.top() > viewport_height) { |
| 679 | return; // off-screen or collapsed — skip the value lookup entirely |
| 680 | } |
| 681 | const QString text = value_provider_(key); |
| 682 | if (text == item->text(kValueColumn)) { |
| 683 | return; // value unchanged — skip setText so a stable cell emits no |
| 684 | // dataChanged / repaint (the bulk of the value column's CPU at 10 Hz) |
| 685 | } |
| 686 | item->setText(kValueColumn, text); |
| 687 | // Full value as a tooltip so a string left-elided in the narrow Value column |
| 688 | // (or a long number) stays readable on hover; trimmed of the alignment padding. |
| 689 | item->setToolTip(kValueColumn, text.trimmed()); |
| 690 | } |
| 691 | |
| 692 | void CurveTreeView::scheduleValueRefresh() { |
| 693 | // This coalesces VISIBILITY-driven re-applies (expand/collapse/scroll/resize) |
nothing calls this directly
no test coverage detected