View Single Post
Posts: 650 | Thanked: 619 times | Joined on Nov 2009
#1
I want to implement something like Harmattan's default pull-down search bar. My implementation is like this:

Code:
ListView {
    onMovementStarted: { 
        // trigger pull-down item 
        showPulldownItem(contentY, verticalVelocity);
    }
    onMovementEnded: { 
        // trigger timer to hide pull-down item 
        timer.restart();
    }
}

Timer {
    id: timer
    onTriggered: { pulldownItem.state = ""; }
}
I want the pull-down item only when the listview is pulled down from the top of the list. ContentY is used to detect top-of-list, but I am stuck at detecting the vertical direction. The problem is, verticalVelocity is 0 when movementStarted signal is triggered so I cannot use it for the detection. Is there any other way to detect the direction?

I have googled and saw some pull-down implementations are triggered by "onMovementEnded". However, I don't like the solution because there is a significant delay before the pull-down item is invoked.