Results 1 to 3 of 3

Thread: Child GraphicsItems Not Getting itemChange()

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Question Child GraphicsItems Not Getting itemChange()

    I have two QGraphicsRectItem objects with one being the child of the other. So I have a parent and a child.

    I'm trying to track the movement of the child whenever the parent is moved.

    These two flags are set for both object.
    setFlag(ItemIsMovable);
    setFlag(ItemSendsGeometryChanges);

    When the parent item is moved itemChanged() is called with ItemPositionHasChanged,
    but the child's is never called. I tried using ItemParentHasChanged, but that isn't being called.

    Anyone have any thoughts? Here's the function:

    Qt Code:
    1. QVariant Node::itemChange(GraphicsItemChange change, const QVariant &value)
    2. {
    3. switch (change) {
    4. case ItemPositionHasChanged:
    5. qDebug() << "ItemPositionHasChanged";
    6. break;
    7.  
    8. case ItemParentHasChanged:
    9. qDebug() << "ItemParentHasChanged;
    10. break;
    11. default:
    12. break;
    13. };
    14.  
    15. return QGraphicsItem::itemChange(change, value);
    16. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 20th October 2010 at 01:17.

Similar Threads

  1. move GraphicsItems within a GraphicsScene
    By rambo83 in forum Newbie
    Replies: 7
    Last Post: 4th November 2009, 14:40
  2. itemChange method
    By zgulser in forum Qt Programming
    Replies: 4
    Last Post: 17th August 2009, 09:19
  3. Moving Items with itemChange?
    By konvex in forum Qt Programming
    Replies: 5
    Last Post: 21st November 2008, 14:36
  4. GraphicsItems and layouts
    By godmodder in forum Qt Programming
    Replies: 1
    Last Post: 17th November 2008, 08:43
  5. itemChange() glibc invalid pointer
    By dreamer in forum Qt Programming
    Replies: 2
    Last Post: 3rd May 2008, 09:04

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.