Results 1 to 5 of 5

Thread: QGraphicsEllipseItem: ItemSendsScenePositionChanges move event?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2007
    Posts
    33
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question QGraphicsEllipseItem: ItemSendsScenePositionChanges move event?

    Hi,

    i have a 4 vertices:

    Qt Code:
    1. Vertex::Vertex(int x, int y) : QGraphicsEllipseItem(x-1,y-1,x+1,y+1)
    2. {
    3. QPen currentPen = pen();
    4. currentPen.setColor(Qt::blue);
    5. currentPen.setWidth(3);
    6. setPen(currentPen);
    7. setAcceptsHoverEvents( true );
    8. setFlag( QGraphicsItem::ItemIsMovable, true );
    9. setFlag( QGraphicsItem::ItemSendsScenePositionChanges, true );
    10. }
    To copy to clipboard, switch view to plain text mode 

    that describe a polygon (QGraphicsPathItem)
    they are added to a QGraphicsScene in a QGraphicsView.

    So far, everything's fine; i can move the the vertices around, hover effects and so on are working fine.

    But now, i want to adjust the polygon if a user changes a vertex.
    Is there any event the QGraphicsEllipseItem emits when moved?
    Or does the QGraphicsScene have an event to tell me it's content hast changed?

    i am looking for something like:

    Qt Code:
    1. connect(m_scene, SIGNAL(changed()),
    2. this, SLOT(updatePolygon()));
    To copy to clipboard, switch view to plain text mode 

    or

    Qt Code:
    1. Vertex* vertex = new Vertex(event->x(), event->y());
    2. connect(vertex, SIGNAL(ItemPositionHasChanged()),
    3. this, SLOT(updatePolygon()));
    To copy to clipboard, switch view to plain text mode 

    but both didn't work
    Last edited by Lykurg; 24th September 2010 at 16:09. Reason: changed [qtclass] to [code]

Similar Threads

  1. QAbstractItemView not calling mouse move event function
    By sagirahmed in forum Qt Programming
    Replies: 0
    Last Post: 5th July 2010, 10:26
  2. Problem in Move Move Event Handler.
    By redgoof in forum Qt Programming
    Replies: 0
    Last Post: 7th April 2010, 11:45
  3. QGraphicsEllipseItem
    By navi1084 in forum Qt Programming
    Replies: 2
    Last Post: 17th July 2009, 08:48
  4. mouse move event filtering in PyQt4
    By lucaf in forum Qt Programming
    Replies: 1
    Last Post: 4th April 2009, 14:53
  5. Mouse Move Event
    By merry in forum Newbie
    Replies: 5
    Last Post: 3rd June 2007, 06:26

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.