Hello,
I assume you are trying to make some kind of electronic circuits designer.
I'm afraid that your approach is a little too simple.
You should keep account of your ports.
For example, let's say you have an AND port in the scene.
Next, you add an OR port and you want to connect it to the output of the AND port.
Initially the OR port will be placed somewhere in the scene. You drag it with the mouse and when you are near the output of the and the OR will snap to the AND port and automatically a connector will be created.
By snap I mean that one input of the OR port will be aligned to the output of the AND gate.
If you drag it further the connector disappears.
All I am trying to say is that your app should be more interactive.
Keeping account of the items is not hard. You always can access them via QGraphicsScene::items.
When you drag a port you just look at the other items near it, to see if you can connect to one of the them ( maybe define a snap distance ).
Regards




Reply With Quote
Bookmarks