[Qt-interest] Chicken and egg: SvgRender and Pixmap?

Andreas Pakulat apaku at gmx.de
Wed Jan 27 07:14:46 CET 2010


On 26.01.10 21:37:30, Jason H wrote:
> Ah, nevermind. I was using viewBox(), which was giving me (0,0,4,5) I wanted defaultSize()
> 
> But interestingly enough, I have to call painter.end() after calling renderer.render()
>         painter = QPainter(pixmap)        
>         renderer.render(painter)
>         painter.end()
> else I get the warning
> QPaintDevice: Cannot destroy paint device that is being painted
> 
> It seems odd that I don't have to call begin(), but I do have to call end()...

begin() is called in the QPainter constructor because you're passing a
qpaintdevice to it. See also the api docs. Hence you need to call end or
destroy the painter by putting a scope around its usage.

Andreas

-- 
You will have long and healthy life.



More information about the Qt-interest-old mailing list