Results 1 to 4 of 4

Thread: setZValue of QGraphicsItemGroup

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2006
    Posts
    83
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default setZValue of QGraphicsItemGroup

    I have a scene with a mosaic of QGraphicItemGroup's and I'm trying to make it when the user clicks on one of the QGraphicsItemGroup's it will bring it to the front. I have tried a few modifications of the following code snippit with no success.
    Qt Code:
    1. bool form::eventFilter(QObject *o, QEvent *e)
    2. {
    3. if (o == ui.view->viewport())
    4. {
    5. QPointF point = ui.view->mapToScene(ui.view->mapFromGlobal(QCursor::pos()));
    6. QGraphicsItem *tmp = ui.view->itemAt(point.x(), point.y());
    7. if (tmp != 0)
    8. tmp->setZValue(1000.0);
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 
    Am I not supposed to be using the QGraphicsView's eventFilter for this?
    When I use the itemAt function it returns a QGraphicsItem. Does it need to be a QGraphicsItemGroup?

    Any tips would be great...

    Note: I posted a similar question a while back, but I don't see this as the same question. In my previous post I was able to add an object to a new QGraphicsItemGroup prior to setting the ZValue. In this case, I already have the group's created, and I just want to display a certain one above others.

    Thanks!
    Last edited by forrestfsu; 6th November 2006 at 18:38.

Similar Threads

  1. setZValue with groupitem doesn't seem to work
    By forrestfsu in forum Qt Programming
    Replies: 1
    Last Post: 24th October 2006, 21:39
  2. Delete all members in a QGraphicsItemGroup
    By vmferreira in forum Qt Programming
    Replies: 3
    Last Post: 17th August 2006, 18:47

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.