PDA

View Full Version : Qgraphicsscene/view connection line avoiding collision with other grapicsitems



salcin
3rd October 2013, 08:42
Hi,

I want to connect two graphicsitems with a line in a graphicsscene. Right now, all I have is a straight line between the items. But I want to make the line go around other items in the view. It is OK for the line to cross another line.

Is there a standard way to do this in QT?

I have been thinking to use QGraphicsPathItem instead of the QGraphicsLineItem that I'm currently using for the line. But how do I choose the best way to route the line?


Thanks!

wysota
3rd October 2013, 08:53
I have been thinking to use QGraphicsPathItem instead of the QGraphicsLineItem that I'm currently using for the line. But how do I choose the best way to route the line?

You need to implement an algorithm that calculates the route. This has nothing to do with Qt.

salcin
3rd October 2013, 13:20
That was my suspicion. Thanks for the confirmation.