Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Click on a line drawing graph and find element



  • Hello,
    this is not really a Qt question but maybe in Qt has a integrated solution for this
    I have primitive line drawing graph. On it I see a car (strictly 5 graphs showing front, back, left, right, top side of a car).
    The use can click/touch on the graph and the software should detect what component (f.e. bumper, door, etc.) and which point on that component was clicked.

    I had never such a request before and dont know what is the standard solution for this task.

    My idea is to show the graph in a bitmap on the screen and define before ellipses or polygons matching objects shown in the graph. Develop an algorithm that find envelopping polygons for a click-point. (I remember barely on a determinate of a matrix).

    Is this the right way ? Has Qt - some tools for this task ?

    Thanks for help
    Andreas


  • Lifetime Qt Champion

    Hi,

    What technology are you using ? QGraphicsView ? Qt Quick ?

    On possible way is to have one item per clickable car piece and you assemble these items to become your car.



  • Hi @SGaist

    The app ist widget-based. It is still open what technic, but I would prefer QGrapicsView.

    Do you mean I should put Objects in a GraphScene for every piece and "construct" the car, to draw it on screen and detect clicks. (Use no bitmap for the car but, digitize the given drawing.)


  • Lifetime Qt Champion

    Is it going to be 2D or 3D ?



  • @SGaist 2D



  • @Andy314 said in Click on a line drawing graph and find element:

    Do you mean I should put Objects in a GraphScene for every piece and "construct" the car, to draw it on screen and detect clicks. (Use no bitmap for the car but, digitize the given drawing.)

    Yes. You can create your car using different QGraphicItems (front / rear bumper... etc.) and put them together. Each click can be handled different to perform some actions.
    If you dont want to design your parts with Qt, you can also use images and assign them to your items.


Log in to reply