Search code examples
c++qtuser-interfacedraggable

How to drag an item along a fixed path? [in Qt Graphics View]


How would you make an object like the red one in this picture be dragged along the white line so that it rotates as the line curves and stays fixed on the line?

Using GraphicsItems in Qt.

enter image description here


Solution

  • As Daniel Sanchesz said:

    get the circle radius, ofsset you box, rotate over the circle center, learn some math