Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Bug] Binding from an instance of the delegate's repeater to another instance of it
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Merinas
    wrote on 22 Sept 2011, 14:08 last edited by
    #1

    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

    1 Reply Last reply
    0

    1/1

    22 Sept 2011, 14:08

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved