[Interest] double-buffering, quality drop
Alexander Semke
Alexander.Semke at web.de
Tue Feb 3 10:02:10 CET 2015
Am Dienstag, 3. Februar 2015, 09:40:02 schrieb Michael Sué:
> 1) Does your QPixmap look correct if you save it to a file?
No.
> 2) We do something similar in a QGraphicsView derived class with the
> following differences:
>
> - we use a QImage object (as we have to fill it pixel by pixel)
> - we draw the QImage in drawBackground
>
> This way SmoothPixeltransform works definitely (never checked for scaling <
> 1 of the image geometry, though).
Yes, we also have similar code in our project. The worksheet - the object
where all plots etc. are placed on - is derived from QGraphicsView and can
have a background image that we plot in drawBackground(). The user can select
whether to scale the provided image or not. There're no problems with the
quality here.
> But we always draw the graphics items live in the paint events i.e. relay to
> the default QGraphicsView::paintEvent().QGraphicsView is initialized with
> setRenderHint(QPainter::Antialiasing);
This was what we did before. But for big data sets (say > 50k points) painting
of the lines and symbols is slow. It's better to draw to a pixmap first and to
update it only when the user changes curve properties (symbol style, line
color etc.) and to do a drawPixmap() in paint() which is called more
frequently. Similar technique is used in similar projects like kst and kmplot.
They don't have those kind of problems and there code is pretty much the same
what we did now for LabPlot. I'm upset and desperate :-(
--
Alexander
More information about the Interest
mailing list