All pastes #2072387 Raw Edit

qml repeater itemAt

public text v1 · immutable
#2072387 ·published 2011-05-30 16:58 UTC
rendered paste body
import Qt 4.7

Rectangle {
    width: 500
    height: 500
    color: "black"

    Row {
        Repeater {
            id: therepeater
            objectName: "therepeater"

            model: 5
            delegate: Rectangle {
                color: "red"
                width: (index+1)*50
                height: 50
            }
        }
    }

    Rectangle {
        width: 100
        height: 50
        x: 100
        y: 200
        color: "red"

        MouseArea {
            width: 100
            height: 50
            onClicked: hre();
        }
    }

    function hre()
    {
        console.log("count = " + therepeater.count);
        for( var i=0;i < therepeater.count; i++ )
        {
            var c = therepeater.itemAt(parseInt(i));
        }
    }
}