Results 1 to 5 of 5

Thread: QGraphicsItem::ItemIgnoresTransformations and redrawing artifacts

  1. #1
    Join Date
    Oct 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default QGraphicsItem::ItemIgnoresTransformations and redrawing artifacts

    Hi,

    I am implementing a graphics view to display a motion captured point trace. I use a QGraphicsPathItem for the trace, and a QGraphicsEllipseItem to indicate the current position. The user has to be able to zoom and pan the view, but the current position indicator has to stay the same size in pixels.

    So I decided to use the QGraphicsItem::ItemIgnoresTransformations flag on the ellipse so it ignores the scaling of the view. It works as intended, but on Mac OS there are redrawing artifacts (the ellipse stays on screen until a full redraw). I'm not sure why the artifacts are not present in Windows, but my guess is that this is an issue with the boundingRect of the item which misbehaves in combination with the QGraphicsItem::ItemIgnoresTransformations flag.

    Is this a know issue? Are there any good workarounds? Maybe creating a custom implementation for the "non-scalable dot", ignoring the scaling in the boundingRect method, is the best way? Are there better ways to draw dots instead of a QGraphicsEllipseItem?

    Greetings,
    JeDi

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

    Default Re: QGraphicsItem::ItemIgnoresTransformations and redrawing artifacts

    If it is your custom item, please show its boundingRect() and paint() implementations.
    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
    Oct 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QGraphicsItem::ItemIgnoresTransformations and redrawing artifacts

    No, I am using a standard QGraphicsEllipseItem. That's why I think this behavior is strange. I could of course write a custom item and implement my own correct boundingRect function, but because I used a standard item I expected it to render without artifacts.

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

    Default Re: QGraphicsItem::ItemIgnoresTransformations and redrawing artifacts

    Could you show us some example code that demonstrates the problem?
    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.


  5. #5
    Join Date
    Oct 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default [SOLVED] QGraphicsItem::ItemIgnoresTransformations and redrawing artifacts

    I'm sorry, I forgot to add this topic to my watch list and didn't see this reply...

    I don't have any simple example code for now, but it is a scene with standard ellipse items with the ignore transforms option set. Because I used meters as my units, the scene is zoomed in a lot to fit on the screen (meters to pixels).

    I am now using QT5, and because there pens are not cosmetic by default anymore (when using a width of 0) I had to convert all pens (mostly of reference lines I draw) to explicitly be cosmetic. There are no artifacts anymore, and they are also gone when I compile in QT 4.8.3.

    So the artifacts were maybe not caused by the ellipses, but by the default pens I used, in combination with a large zoom factor?

    Edit Actually, I just compiled with QT 4.8.1, and the artefacts are still present. They are completely gone in QT5 beta2 though.
    Last edited by JeDi; 21st November 2012 at 16:11.

Similar Threads

  1. QGraphicsScene artifacts
    By psih128 in forum Qt Programming
    Replies: 7
    Last Post: 17th February 2011, 13:19
  2. Problem with QGraphicsView and ItemIgnoresTransformations
    By coderCPP1981 in forum Qt Programming
    Replies: 6
    Last Post: 27th June 2008, 05:28
  3. Rubber band artifacts?
    By mooreaa in forum Qt Programming
    Replies: 1
    Last Post: 25th June 2008, 18:19
  4. Replies: 3
    Last Post: 13th November 2007, 10:30
  5. QGV: ItemIgnoresTransformations and RubberBand
    By Vladimir in forum Qt Programming
    Replies: 1
    Last Post: 9th June 2007, 14:38

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.