[Interest] Avoiding binding loop

Nuno Santos nunosantos at imaginando.pt
Thu Oct 16 17:00:27 CEST 2014


Hi,

I’m trying to make a menu that grows below the selected item to show its contents. The code below is a part of the ListView delegate. 

The problem is that I want to make the contentContainer height equal to the content height, but I always end up with a binding loop. 

Rectangle {
   id: contentContainer
   anchors.top: item.bottom
   width: parent.width
   height: 0

   states: [
       State {
           when: root.currentIndex==index
           PropertyChanges {
               target: contentContainer;
               height: content.height
           }
       }
   ]

   transitions: [
       Transition {
           PropertyAnimation { properties: "height"; duration: 50 }
       }
   ]

   Loader {
       id: content
       width: parent.width
   }
}

Can anyone give me a suggestion on how to solve this problem?

Regards,

Nuno Santos


More information about the Interest mailing list