Re-parent to Flickable area failed



  • Hello! I try to reparent a Rectangle / Item what ever to a flickable list. This works but is not flickable. What I'm doing wrong?

    • Max
      @
      //... code above
      Rectangle {
      id: content
      color: "green"
      anchors.top: controlBar.bottom
      anchors.topMargin: 5
      anchors.left: parent.left
      anchors.right: parent.right
      anchors.bottom: begaLogo.top
      anchors.bottomMargin: 5

        Flickable {
            id: flickArea
            anchors.horizontalCenter: parent.horizontalCenter
            width: 300
            height: 300
            contentWidth: dings.width
            contentHeight: dings.height
            clip: true
        }
        Rectangle {
            id: dings
            color:"white"
            width: 500
            height: 500
            anchors.centerIn: parent
            states: State {
                         name: "reparented"
                         ParentChange { target: dings; parent: flickArea; x: 10; y: 10 }
                     }
            MouseArea { anchors.fill: parent; onClicked: dings.state = "reparented" }
            //parent: flickArea
        }
      

      }@



  • Try to remove
    @
    anchors.centerIn: parent
    @
    from dings



  • Sadly it doesn't work. :( Only if i parent it directly. So anchors.centerIn has no effect on that. :(

    @Rectangle {
    id: content
    color: "green"
    anchors.top: controlBar.bottom
    anchors.topMargin: 5
    anchors.left: parent.left
    anchors.right: parent.right
    anchors.bottom: begaLogo.top
    anchors.bottomMargin: 5

            Flickable {
                id: flickArea
                anchors.horizontalCenter: parent.horizontalCenter
                width: 300
                height: 300
                contentWidth: dings.width
                contentHeight: dings.height
                clip: true
                Rectangle {
                    id: dings
                    color:"white"
                    width: 500
                    height: 500
                    anchors.centerIn: parent
                    states: State {
                                 name: "reparented"
                                 ParentChange { target: dings; parent: flickArea; x: 10; y: 10 }
                             }
                    MouseArea { anchors.fill: parent; onClicked: dings.state = "reparented" }
                    //parent: flickArea
                }
            }
    

    @


Log in to reply
 

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