Results 1 to 1 of 1

Thread: QGraphicsScene Z Ordering

  1. #1
    Join Date
    Aug 2011
    Posts
    19
    Thanks
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QGraphicsScene Z Ordering

    I have a bunch of QGraphicsItem's that can be added and removed from my scene by my users at any given time.

    In the code, certain QGraphicsItem child classes that I derived have a setZValue() in their constructor that sort items the way I would want them to be sorted

    Ship = 1.0 (always on top)
    Waypoints = 0.9
    Targets, Markpoints = 0.8
    RangeRings, ErrorEllipse = 0.5
    Waypoint Lines = 0.4
    Map = 0.0 (Always on bottom)

    Yet, as the users add items to and from the scene, the Z sorting seems to be ignored! It just sorts by insertion order!

    How do I get the QGraphicsScene to actually LOOK at the Z values I've set for these items and USE them? Is there a refresh function or something I'm suppose to call?


    Added after 10 minutes:


    Nevermind, I got it fixed.

    I removed the setZValue() out of the constructor, and put it down to where I call addItem() in the scene, and it seems to work now. Whatever.
    Last edited by bruceariggs; 27th September 2011 at 16:41.

Similar Threads

  1. Static Linking Ordering Issues
    By SneakyPeterson in forum Newbie
    Replies: 1
    Last Post: 11th June 2010, 12:51
  2. Too Much RAM used by QGraphicsScene
    By grabalon in forum Qt Programming
    Replies: 4
    Last Post: 6th May 2010, 16:38
  3. Bug in QGraphicsScene?
    By tbcpp in forum Qt Programming
    Replies: 2
    Last Post: 12th June 2009, 15:23
  4. in QGraphicsScene matrix of other QGraphicsScene
    By Noxxik in forum Qt Programming
    Replies: 5
    Last Post: 15th February 2009, 18:27
  5. QGraphicsSCene
    By bhogasena in forum Qt Programming
    Replies: 1
    Last Post: 30th January 2009, 00:58

Tags for this Thread

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.