PDA

View Full Version : QPaintEngine and QGraphicsPolygonItem



magland
19th August 2008, 16:25
I have implemented a custom backend QPaintEngine for purpose of creating windows meta files from QGraphicsView. Everything is fine so far, but I am encountering the following problem:

I expected QGraphicsPolygonItem objects to be drawn via QPaintEngine::drawPolygon(). But it seems that instead QPaintEngine::drawImage() is being called. This is a problem for me, because I really want to get the drawPolygon commands, so I can properly export to the meta file.

One idea I have is to implement my own version of QGraphicsPolygonItem... but then I'll need to change the graphics view internals. Does anyone know how to force Qt to use the drawPolygon method?

magland
19th August 2008, 17:03
Okay, I found the solution, so I will answer my own post.
The key is to set the appropriate PaintEngineFeatures. In my case I set only the following:

QPaintEngine::PainterPaths|QPaintEngine::Primitive Transform

So I can now copy QGraphicsView contents to clipboard as windows metafile.