Results 1 to 9 of 9

Thread: problem rendering garbled when rendering twice (QGraphicsScene->render(..))

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2009
    Location
    the Netherlands
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem rendering garbled when rendering twice (QGraphicsScene->render(..))

    I created another image, because I suspected it had something to do with the graphicTask objects (the green and blue rectangles). Some of these objects are partly in the rendered picture and partly outside it. (i.e. boundingRect() is partly outside the image) I shifted these task objects and recreated the image. Now I see that some of the timeline of the first render is also in the second image. This is strange because I use a newly created image (see the code) and render to that.
    I also created an image without any task obejcts (only the timeline and the night-time rectangles (the grey rectangles) are in the image. When I do this it does not garble up the second image (see attached test2.jpg)
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: problem rendering garbled when rendering twice (QGraphicsScene->render(..))

    So how about that example code?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2006
    Location
    Norway
    Posts
    124
    Thanked 38 Times in 30 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: problem rendering garbled when rendering twice (QGraphicsScene->render(..))

    Make sure to initialize the image. By default it's full of uninitialized pixels, and QGraphicsScene::render() will blend on top (source-over composition). When your app starts, chances are when you create the first image, it's going to be blank because the OS blanks those bits. Second time however, the image is likely to contain junk from the last time you rendered.

    See QImage::fill(). Don't know if that will solve the problem but it's worth a shot...
    Bitto / Andreas Aardal Hanssen - andreas dot aardal dot hanssen at nokia
    Nokia Software Manager, Qt Development

  4. #4
    Join Date
    Nov 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: problem rendering garbled when rendering twice (QGraphicsScene->render(..))

    Quote Originally Posted by Bitto View Post
    Make sure to initialize the image. By default it's full of uninitialized pixels, and QGraphicsScene::render() will blend on top (source-over composition). When your app starts, chances are when you create the first image, it's going to be blank because the OS blanks those bits. Second time however, the image is likely to contain junk from the last time you rendered.

    See QImage::fill(). Don't know if that will solve the problem but it's worth a shot...
    This explanation is the right point and helps me out of my struggle. Thanks Bitto.

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.