[Interest] ** Caution Message may be spoofed ** Re: Zooming with QGraphicsView/QGraphicsItem

Murphy, Sean smurphy at walbro.com
Fri Aug 9 21:56:14 CEST 2019


> So using QGIS to convert my .shp files to .svg, and then loading the result in a
> QGraphicsSVGItem works like a charm - thanks! The only drawback I’m seeing
> is zooming performance. It *looks* good, but is a tad sluggish. When using 
> QGIS, I noticed that it was compiled against Qt as well, but when they zoom,
> the actual image redraw is delayed until the zoom is complete. That is, when
> zooming in, things get pixelated until you pause, whereupon they are re-drawn
> correctly. When zooming out, areas that were outside the window remain empty
> until you pause, at which point they are drawn. The end result is that things look
> worse when zooming, but zoom performance is lag-free. Is this behavior easily
> obtainable, such as through a setting on the QGraphicsSVGItem or perhaps the
> QGraphicsView, or is QGIS doing something completely different, such that I
> would have to do a lot of re-implementation to accomplish said effect?

It sounds like their strategy is something like this: when the initial image is loaded 
(or when the user stops zooming), they show that image and they also make a raster 
version of it. Then as the user requests a zoom, they instantly rescale/resize/crop 
the raster image to present the pixelated (on zoom in) or the empty areas (on 
zoom out) versions. At the same time they start a timer, if the user continues to 
zoom before that timer expires they just keep working with the raster image and 
keep resetting the timer. Only once the timer expires (which is when the user 
stops zooming) do they actual do the real zoom and redraw the scene at the new 
desired resolution. This should give you faster speed, while not having you go 
through all the work of the intermediate zoom levels - you'll only have to generate 
the final zoomed scene for each zoom sequence.

Sean


This message has been scanned for malware by Forcepoint. www.forcepoint.com


More information about the Interest mailing list