Narada
4th April 2016, 04:18
I am trying out an example from
http://www.informit.com/store/c-plus-plus-gui-programming-with-qt4-9780132354165
Chap08/diagram.pro
The program compiles, but does not work as advertised. When you move the nodes, the links are supposed to move with the nodes. I used the debugger and found out that it never hits the if condition in
QVariant Node::itemChange(GraphicsItemChange change,
const QVariant &value)
{
if (change == ItemPositionChange) {
foreach (Link *link, myLinks)
link->trackNodes();
}
return QGraphicsItem::itemChange(change, value);
}
If I take the if condition out, I sort of get to move the links, but after clicking on the graphics scene.
Any insight would be great into what the problem is.
http://www.informit.com/store/c-plus-plus-gui-programming-with-qt4-9780132354165
Chap08/diagram.pro
The program compiles, but does not work as advertised. When you move the nodes, the links are supposed to move with the nodes. I used the debugger and found out that it never hits the if condition in
QVariant Node::itemChange(GraphicsItemChange change,
const QVariant &value)
{
if (change == ItemPositionChange) {
foreach (Link *link, myLinks)
link->trackNodes();
}
return QGraphicsItem::itemChange(change, value);
}
If I take the if condition out, I sort of get to move the links, but after clicking on the graphics scene.
Any insight would be great into what the problem is.