#204 QwtPlotDirectPainter - "eats" external repaints, leaves old image

open
nobody
None
5
2014-03-20
2014-03-12
Anonymous
No

When QwtPlot::update() called(by resize, zoom/pan, setVisible) right before QwtPlotDirectPainter call,
QwtPlotDirectPainter goes through

if ( !immediatePaint )
canvas->repaint(...); ->
eventFilter(...) {
...
return true;
}

and we get no repaint from earlier update() for canvas.
This leads to lost full-repaint event, and old canvas image.

Example result is in attach. I can reproduce this in several ways,
like resizing, QStackedWidget::setCurrentIndex, zoom/pan.

I found that i can detect that by overloading qwtplot::paintEvent, setting a flag in there,
and check it after QwtPlotDirectPainter is finished, then re-triggering full repaint.

1 Attachments

Discussion

  • Anonymous

    Anonymous - 2014-03-12

    add screenshot of full-repaint of same plot state

     
  • Uwe Rathmann

    Uwe Rathmann - 2014-03-13

    To avoid the issue it would be necessary to detect pending updates in drawSeries or to check the paint event in eventFilter if other updates have been merged into it. For both approaches there is no obvious solution.

    A more promising idea might be to call QApplication::sendPostedEvents( plot->canvas(), QEvent::Paint or QEvent::UpdateRequest ) to flush all pending updates before calling QwtPlotDirectPainter;;drawSeries().

    For any further discussion please start a discussion on the mailing list.

    A possible workaround would be to enable QwtPlotDirectPainter::FullRepaint. It is less efficient as it always flushes the complete backing store of the canvas, but better than full replots, where the backing store would always be repainted from scratch before.

     
  • Uwe Rathmann

    Uwe Rathmann - 2014-03-20

    Another easy workaround would be setting QwtPlotCanvas::ImmediatePaint to true.

     
    Last edit: Uwe Rathmann 2014-09-12

Anonymous
Anonymous

Cancel  Add attachments