'Connect points stored inside model with line

I need to connect points which are stored inside model with lines (A-->B, B-->C, C-->D, and D-->A). Model:

    ListModel {
            id: myModel
            ListElement { name: "A"; xCoordinate: 100; yCoordinate:200 ; }
            ListElement { name: "B"; xCoordinate: 50; yCoordinate:87 ; }
            ListElement { name: "C"; xCoordinate: 200; yCoordinate:15 ; }
            ListElement { name: "D"; xCoordinate: 150; yCoordinate:30 ; }
        }

I tried Repeater with PathLine, but without success. To draw a line, I need to access 2 elements from model at once, how to achieve this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source