[Qt-qml] can't scroll a flickable

Bartosh Wroblevksy bartosh at live.com
Mon Aug 30 22:23:48 CEST 2010


Hello QML'ers

Want to check if this is a bug or if I am doing something wrong.  Running the following code, Qt beta 2, if I do a keypress once, it flicks as expected
to contentX = 1024. When I flick back and hit the key press again, it DOES NOT scroll to 1024. If I comment out the "Behavior on ContentX" portion, it magically works. What am I doing wrong?


Flickable{
    id:panelsContainerFlickable
    anchors.fill: parent

    width:  800
    height: 600

    contentHeight:600
    contentWidth: 2048



    focus: true
    Keys.onPressed: { console.log( "scrolling")
        console.log(  panelsContainerFlickable.contentX  )
                      panelsContainerFlickable.contentX = 1024
                  console.log(  panelsContainerFlickable.contentX  )}

    Behavior on contentX {
        NumberAnimation {
           // easing.type: Easing.Linear
            duration: 500
        }
    }


    Rectangle {

         width: 2048; height: 600
         gradient: Gradient {
             GradientStop { position: 0.0; color: "red" }
             GradientStop { position: 0.33; color: "yellow" }
             GradientStop { position: 1.0; color: "green" }
         }
         rotation: 90
     }
}

Thanks,
Bartosh
 		 	   		  



More information about the Qt-qml mailing list