QtQuick Flickable kinetic movement



  • How to make (using Flickable) kinetic movement of any item on scene? I mean object is able to move (with inertia) although mouse/touch are gone...



  • Did you try flickDeceleration (property of Flickable)?



  • No, I will look at that...



  • Hmm... I am thinking wrong (again)... I can't move with rectangle inside flickable element (what am I doing wrong?!)
    @

    // Nothing really happens
    Flickable
    {
    id: flickable
    boundsBehavior: Flickable.DragAndOvershootBounds
    flickDeceleration: 0.5
    contentHeight: rect.height
    contentWidth: rect.width

    Rectangle
    {
          id: rect
    
          width: 60
          height: 60
    
         color: "red"
    }
    

    }
    @

    Well I think, I am thinking wrong once again ... flickable is just working inside the area of flickable, but not outside??



  • Hi,

    I'm not sure if I understand exactly what you are after, but adding a width and height to the Flickable, e.g.

    @width: 400; height: 400@

    should make it possible to flick the Rectangle. If you want to flick the Rectangle, and not have it snap back to its original position, you can use a larger contentWidth and contentHeight and play around with the positioning/hierarchy/etc, e.g.

    @Flickable
    {
    id: flickable
    width: 400; height: 400
    boundsBehavior: Flickable.DragAndOvershootBounds
    contentWidth: 740; contentHeight: 740

    Rectangle
    {
        id: rect
    
        width: 60
        height: 60
        x: 340; y: 340
    
        color: "red"
    }
    

    }@

    Regards,
    Michael



  • The problem is I can't have Flickable through the whole scene because there are also other active objects...hmm... I just want to move that rectangle on scene, but not to affect other objects...

    okay that flicking is working, but it means Flickable is just an area, where I can flick?...



  • [quote author="Peppy" date="1342210863"]okay that flicking is working, but it means Flickable is just an area, where I can flick?...[/quote]

    Yes, that sounds correct.

    You might be able to get something working using the Flickable in a non-traditional manner, for example overlaying the scene with a Flickable with the Flick dynamics you are looking for, and then binding the Rectangle's position based on contextX/contentY (rather than the Rectangle being a child of the Flickable).

    Regards,
    Michael



  • I thought, the Flickable is container that allows to move with the object inside over the scene.

    Yes, I am looking for kinetic movement with inertia...


Log in to reply
 

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