QGraphicsEllipseItem: ItemSendsScenePositionChanges move event?
Hi,
i have a 4 vertices:
Code:
{
currentPen.setColor(Qt::blue);
currentPen.setWidth(3);
setPen(currentPen);
setAcceptsHoverEvents( true );
}
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:
Code:
connect(m_scene, SIGNAL(changed()),
this, SLOT(updatePolygon()));
or
Code:
Vertex* vertex = new Vertex(event->x(), event->y());
connect(vertex, SIGNAL(ItemPositionHasChanged()),
this, SLOT(updatePolygon()));
but both didn't work
Re: QGraphicsEllipseItem: ItemSendsScenePositionChanges move event?
See QGraphicsItem::itemChange() with QGraphicsItem::ItemPositionChange. If you need signals to inform your scene or whatever inherit QObject. Also not the difference between [QTCLASS] and [CODE].
Re: QGraphicsEllipseItem: ItemSendsScenePositionChanges move event?
Quote:
Originally Posted by
Lykurg
See
QGraphicsItem::itemChange() with QGraphicsItem::ItemPositionChange. If you need signals to inform your scene or whatever inherit
QObject. Also not the difference between [QTCLASS] and [CODE].
Code:
{
cout << "test" << std::endl;
}
itemChange is only called when the vertex is created, not when i move it
Re: QGraphicsEllipseItem: ItemSendsScenePositionChanges move event?
Yeah, sometimes you have to read the documentation ;)
Quote:
This notification is send if the ItemSendsGeometryChanges flag is enabled
Re: QGraphicsEllipseItem: ItemSendsScenePositionChanges move event?
Quote:
Originally Posted by
Lykurg
Yeah, sometimes you have to read the documentation ;)
i did that, but i switched
for
now it's working. thanks