Results 1 to 3 of 3

Thread: [Solved] "zIndex" in a QGraphicsScene

  1. #1
    Join Date
    Dec 2006
    Posts
    160
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default [Solved] "zIndex" in a QGraphicsScene

    Hello people,

    i have read everything i found on the Qt 4.3 doc... and i still dont understand something about items indexing in a QGraphicsView.

    Let's imagine i create a QGraphicsScene, and add 20 items in it when in the visible area... i have done this test, and i have noticed that the first item added is the one behind the others, etc. Then if i scroll outside of the visible area (My Scene is bound to a view), sometimes i notice clipping, some early added items are behind the oldest... Now if i want to take the first added item (Behind the others), and bring it *visually* between item 10 and item 11: how am i supposed to do this?

    Also another question: imagine i have the same example shema, and i take items 1, 3, 5, 7, 9 etc ... 19 and group them to "group1". Then i take all even items (2, 4, 6, 8 etc... 20) and add them to "group2". Will all the items from group1 become "behind" all the items from group2?

    Any enlightenement about zIndexes on the QGraphics framework will be appreciated

    Thanks a lot for your time, and Mery christmas
    Pierre.
    Last edited by hickscorp; 27th December 2007 at 11:46. Reason: Solved :)

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: "zIndex" in a QGraphicsScene

    In short, take a look at QGraphicsItem::setZValue().
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    hickscorp (27th December 2007)

  4. #3
    Join Date
    Dec 2006
    Posts
    160
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: "zIndex" in a QGraphicsScene

    lol man...

    Thanks a lot, i have read everything on QGraphicsView and QGraphicsScene, i didnt spend enough time on QGraphicsItem... It is strange that the zIndex method is on the item, not on the scene!

    Thanks again for the very fast answer
    Pierre.

Similar Threads

  1. Replies: 12
    Last Post: 7th September 2011, 16:37
  2. QPrinter on QGraphicsScene Border Problem
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 14th November 2007, 15:49
  3. Replies: 4
    Last Post: 11th July 2007, 04:21
  4. QGraphicsScene and QGraphicsView
    By rossd in forum Qt Programming
    Replies: 2
    Last Post: 25th April 2007, 14:43
  5. When to use QGraphicsScene or QWidget
    By fossill in forum Qt Programming
    Replies: 2
    Last Post: 9th February 2007, 23:58

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
  •  
Qt is a trademark of The Qt Company.