[Bug] Binding from an instance of the delegate's repeater to another instance of it



  • Hi I'm trying to create bind between object in a repeater but binding is done before repeater as created all object.

    Here an example
    @
    Repeater{
    id:rpt
    model:MyModel{}
    Item{
    property variant previous:rpt.itemAt(index-1)
    property variant next : rpt.itemAt(index+1)
    property int test: index
    Component.onCompleted: console.log(index+": prev: "+previous.test+" next: "+next.test)
    }
    }
    @

    Instead of having a binding create and correct I get an error for each next property I try to bind.
    This should be working. Since we get a itemAt and no way to know if the loading is finished.
    I don't know how that should behave or be written but we need a way of binding other item in the same repeater.

    For now I solved this problem by splitting in two repeater. And this code is working

    @import QtQuick 1.1

    Rectangle {
    width: 100
    height: 62

    Repeater{
        id:rpt2
        model:rpt.count-1
        Item{
            property variant previous:rpt.itemAt(index)
            property variant current : rpt.itemAt(index+1)
            Component.onCompleted: console.log(index+": prev: "+previous.test+" current: "+current.test)
        }
    }
    
    Repeater{
        id:rpt
        model:12
        Item{
            property int test: index
            //has some properties
        }
    }
    

    }@

    But it seems to that is to much complicated for some basics needs. MayBe there another way I Haven't notice.
    Thanks for reading me


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.