Hello forum,

Please Check the attached image. Screenshot-1.jpg. You can see that two elliptical items are connected by an arrow graphics item.

If the user clicks the small ellipse inside the large ellipse an arrow item is instantiated. The arrow item is extended with the mouse move and mouse release event.

I also have over-ridden the following function so that the arrow is adjusted even after the position changes of the elliptical items.

Qt Code:
  1. QVariant H3DHierarchyArrowDockGraphicsItem::itemChange(GraphicsItemChange change, const QVariant &value)
  2. {
  3. switch(change)
  4. {
  5. case ItemPositionHasChanged:
  6. foreach(H3DHierarchyArrowGraphicsItem *arrow, m_hierarchyArrowList)
  7. arrow->adjust();
  8. break;
  9. default:
  10. break;
  11. }
  12.  
  13. return QGraphicsItem::itemChange(change,value);
  14. }
To copy to clipboard, switch view to plain text mode 



But at some point i get the following output while moving the items inside the scene.
Bizarre.jpg



As you can see the arrow is totally detached from the destination item. And the arrow is attached back while moving the elliptical items - not so pleasant behavior, is it?

To get a functional one i have taken hint from elastic nodes, diagram scene example and voreen editor( Qt based volume rendering editor), but it seems that i have missed some ideas to get it right.

To provide me with useful hint i am also attaching the corresponding source files that you need to look into.

H3DHierarchyArrowGraphicsItem.cppH3DHierarchyArrowDockGraphicsItem.cppArrowGraphicsItem.cpp


If the arrow has both the source and destination item i am doing the intersection test just as in the diagramscene example of Qt so that the destination point always slides on the arc of the ellipse. All the arrows that are created has the small ellipse and another larger ellipse as the destination item.

In inside the adjust() function i am trying to update the destination point of the arrow which seems not to be working. Please make some time to go through it.


Thanks
Sajjad