Results 1 to 2 of 2

Thread: QPaintEngine and QGraphicsPolygonItem

  1. #1
    Join Date
    Feb 2007
    Location
    Philadelphia, USA
    Posts
    255
    Thanks
    43
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QPaintEngine and QGraphicsPolygonItem

    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?

  2. #2
    Join Date
    Feb 2007
    Location
    Philadelphia, USA
    Posts
    255
    Thanks
    43
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPaintEngine and QGraphicsPolygonItem

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.