You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Sunday, January 31st 2010, 1:59am

itemChange doesn't pick up on QGraphicsItem::ItemPositionChange

Hey guys, I'm essentially trying to implement this: http://doc.trolltech.com/4.6/graphicsview-diagramscene.html inside a desktop application. Problem is, when i took the following piece of code and used it in my application:

QVariant DiagramShape::itemChange(GraphicsItemChange change, const QVariant &value)
{
if (change == QGraphicsItem::ItemPositionChange)
{
// Update each connector.
for(std::list<DiagramConnector*>::iterator i = Connectors.begin(); i != Connectors.end(); ++i)
{
(*i)->update();
}
}

return value;
}

It will not pick up on the items in the QDiagramScene moving. It will pick up on focus received and lost, but not moving. It's as if Qt isn't even sending me the change. It's driving me nuts, what's going on ?!

2

Thursday, February 11th 2010, 4:42pm

since qt4.6 you have to set "setFlags( ItemSendsGeometryChanges );" to see moveEvents in itemChangeEvent.

Johann