fix: graph jitter on load + format

This commit is contained in:
2026-11-09 20:20:27 +01:00
parent d69a6bcafd
commit e49ecabf62
13 changed files with 181 additions and 320 deletions
+2 -11
View File
@@ -31,20 +31,15 @@ class SparklineContent : public QQuickPaintedItem {
void setViewportSize(qreal viewportWidth, qreal viewportHeight);
// How often a new sample arrives, in milliseconds. With this set the slide
// phase is read from the sample clock rather than from `progress`, which
// makes the wrap exact; without it the phase is the value QML supplies.
void setSlideInterval(qreal intervalMs);
// Offsets the item for the slide. Kept here rather than in SparklineItem
// because the quantization needs both stepX() and the window's dpr.
void setSlideProgress(qreal progress);
[[nodiscard]] qreal stepX() const;
[[nodiscard]] bool slideActive() const;
protected:
// The stroke width, sample spacing and plot bounds are quantized in device
// pixels, so they have to be built with the ratio the window actually has.
void itemChange(ItemChange change, const ItemChangeData& value) override;
private:
@@ -78,13 +73,9 @@ class SparklineContent : public QQuickPaintedItem {
qreal m_viewportW = 0.0;
qreal m_viewportH = 0.0;
// The height actually painted, snapped so the texture maps 1:1 onto device
// rows. The plot bounds are built from this, not from the slot's height.
qreal m_paintedH = 0.0;
qreal m_dpr = 1.0;
qreal m_slideIntervalMs = 0.0;
// Restarted whenever a sample arrives, so the slide phase follows the sample
// cadence instead of the animation's timeline.
QElapsedTimer m_sampleClock;
LineGeometry m_geom1;