I have a C++ property
 Q_PROPERTY(QList<qreal> XTickPos MEMBER _xTickPos);
which I want to use in a Repeater. In the same QML file, the c++ class has been given the id
id: pw
The repeater looks like this
        Item {
            anchors.fill: parent
            visible: true
            Repeater {
                model: pw.XTickPos.length
                Rectangle{
                    height: 50
                    width: 2
                    x: pw.XTickPos[index]
                    y:10
                    visible: true
                    color: "black"
                    border.width: 2
                }
              }
        }
However, nothing is drawn on the screen. If instead I make property in the QML file:
 var xTickPos = []
and set it via a Q_Invokable function in c++
 Q_INVOKABLE QList<qreal> getXTickPositions();
and in QML
 root.xTickPos=pw.getXTickPositions();
and use the QML property xTickPos as model in the above repeater it is working. I checked that pw.XTickPos is correctly filled via a console.log
What am I missing here?
Q_PROPERTY(type name READ name WRITE setName NOTIFY nameChanged)- where you will emit the signalnameChanged()in the setter,setName(...). Then you will have a signal emited. But also only if you set a new list - not when you add something to the list. If you look at doc.qt.io/qt-5/qlist.html you will see that QList does not even have a signal that could notify the length has changed. - derM