PDA

View Full Version : Qt Examples: PortedCanvas



majvan
17th October 2011, 17:47
Hello, I am looking at the example of Qt: PortedCanvas (Qt 4.7.4).
In that example you can insert mesh.
I cannot understand why when I move the node with my mouse, the code


QVariant NodeItem::itemChange(GraphicsItemChange change, const QVariant &value)

is never called. As I can see from the code, it should ensure that also lines connected to the node should move (every NodeItem has its container of out-lines and in-lines).

Is there some issue in the example? Does anybody has the same experience with the given example?

wysota
17th October 2011, 21:46
It's an old example and Qt has come a long way since it was written. In current versions of Qt itemChange() is not called for every change in the item, for those you need to explicitly register using QGraphicsItem::setFlag() passing in QGraphicsItem::ItemSendsGeometryChanges or QGraphicsItem::ItemSendsScenePositionChanges (depending on the effect you want to achieve).

majvan
18th October 2011, 14:27
Thank you. Now it works.