Skip to content

QwtPlot v7.4.2

Choose a tag to compare

@czyt1988 czyt1988 released this 10 Oct 13:47
· 275 commits to master since this release

New Features

  • Render smoothing for curve drawing
    • QwtPlotCurve gains the SmoothAlgorithm enum ( NoSmoothing, GaussianSmoothing, SavitzkyGolaySmoothing ) with setSmoothAlgorithm(), setSmoothWindow(), setSmoothPolynomialOrder() and setSmoothPreserveThreshold()
    • Both algorithms are low pass filters operating on the polyline after downsampling and coordinate translation — only the y coordinates are modified, so the horizontal position of every feature stays exact
    • A non-linear feature preservation step ( enabled by default ) keeps significant peaks and dips at their original position and height: the pixel noise band collapses to a clean line while the data is not distorted
    • Implemented for QwtPlotCurve::Lines ( including filled curves ), combinable with the Fitted attribute
    • New example examples/2D/curvesmoothing: a 100,000 sample spectrum with random jitter — left plot default rendering vs. right plot smoothed, with runtime controls for algorithm / window / SG order / preservation threshold and replot benchmarks
    • New usage guide "Curve Render Smoothing" ( EN/CN, with screenshots )

Bug Fixes

  • Fixed axis backbones being misplaced or missing on the first paint of a plot — the two reported symptoms were a short segment missing at the left of the x axis (x/y backbones not intersecting at the corner, healing only after an axis parameter refresh) and a whole backbone invisible until the next plot update. Root cause: the layout placed the scale widgets using the border distance stored by the previous pass, while the backbone was drawn using the freshly computed one; the corrective relayout is driven by an asynchronous LayoutRequest that is regularly missing or late during the initial show sequence. The fix makes placement and drawing use the same border distance in a single pass and guarantees a layout pass before the first paint:
    • QwtPlotLayoutEngine LayoutData::ScaleData::init() now uses qMax(getBorderDistHint(), borderDist) — the exact value QwtScaleWidget::layoutScale() draws with — instead of the stale stored border distance, closing the one-pass lag at its source
    • QwtPlot::doLayout() refreshes the axis border distances even when the scale rect did not change (tick label content, formats or fonts can alter the hint without changing the geometry)
    • QwtPlot::event() runs updateLayout() after the PolishRequest replot, so the first paint always uses a layout calculated from the final fonts and scale divisions (one extra pass on first show only, no steady-state cost)
    • QwtScaleWidget::changeEvent() handles FontChange/ApplicationFontChange and relayouts on LocaleChange: font changes no longer leave extent and border distances stale without a repaint
    • QwtScaleWidget::setMinBorderDist() recalculates the scale geometry like all other geometry setters (relevant for QwtPlot::alignAxisBorderDist() and QwtFigure::alignAxes())
  • Fixed QwtScaleDraw::setLength() unconditionally clamping to a positive minimum of 10, which silently turned negative lengths (legitimately used by QwtPolarGrid for left/top axes) into +10 and broke polar grid rendering; the upstream clamping semantics are restored (small magnitudes clamped to ±10, larger negative values preserved)
  • Fixed QwtSplineCurveFitter::fitCurve() discarding the fitted result: the return value of subPaths.first() was dropped and an empty polygon was returned, so curves using Fitted together with fill could not be drawn at all; upstream behavior is restored (a single subpath returns that subpath's polygon)