From f0f620c632a6b06a844ba53d12b070f7343a91e8 Mon Sep 17 00:00:00 2001 From: tiresiasfromthebai Date: Tue, 14 Jul 2026 15:47:18 +0200 Subject: [PATCH] Array Visualizer: fix scatter markers losing their style Scatter markers can be recreated by Qt Charts without inheriting the series pen/brush, leaving nearly invisible 1 px markers. This occurs reliably with large datasets while small ones usually render correctly. Reapply the scatter series pen and brush after addSeries() by forcing two actual style transitions. Since the setters are guarded, simply reassigning the existing values is a no-op. Verified on Qt 6.4.2 with both small (100 points) and large (4000 points) datasets. Line and spline series are unaffected. --- src/SeerArrayVisualizerWidget.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/SeerArrayVisualizerWidget.cpp b/src/SeerArrayVisualizerWidget.cpp index 2790713..851cda6 100644 --- a/src/SeerArrayVisualizerWidget.cpp +++ b/src/SeerArrayVisualizerWidget.cpp @@ -24,6 +24,30 @@ #include #include +// +// Qt Charts 6.x workaround: scatter marker items can be (re)created without +// inheriting the series' pen/brush, leaving near-invisible ~1px markers. +// Small arrays usually render fine; large ones (e.g. 4000 points) reliably +// degrade. The series-level state is correct in both cases (verified with an +// instrumented build), so the style is lost at the marker-item level inside +// Qt Charts. Because the series setters are guarded (a call with an unchanged +// value is a no-op), we force two *actual* value transitions so the style is +// pushed down to the marker items unconditionally. +// +static void redecorateScatterSeries (QXYSeries* series) { + + QScatterSeries* scatter = qobject_cast(series); + + if (scatter == nullptr) { + return; + } + + scatter->setPen(QPen(Qt::transparent)); + scatter->setBrush(QBrush(Qt::transparent)); + scatter->setPen(QPen(Qt::NoPen)); + scatter->setBrush(QBrush(QColor(31, 119, 180))); +} + SeerArrayVisualizerWidget::SeerArrayVisualizerWidget (QWidget* parent) : QWidget(parent) { // Init variables. @@ -983,6 +1007,7 @@ void SeerArrayVisualizerWidget::handleDataChanged () { arrayChartView->chart()->addSeries(_aSeries); arrayChartView->chart()->createDefaultAxes(); + redecorateScatterSeries(_aSeries); } if (_bSeries) { @@ -990,6 +1015,7 @@ void SeerArrayVisualizerWidget::handleDataChanged () { arrayChartView->chart()->addSeries(_bSeries); arrayChartView->chart()->createDefaultAxes(); + redecorateScatterSeries(_bSeries); } // Zoom out slightly to allow for text label at edges.