View Single Post
Posts: 650 | Thanked: 619 times | Joined on Nov 2009
#7
The solution I use is like this:
Code:
Page {
  property bool bannerStart: false

  ListView {
    onContentYChanged: {
      if (bannerStart && (contentY <= params.bannerMargin))
        showPullDownItem(); 
    }
    onMovementStart: {
      if (contentY==0) bannerStart = true;
      else                    bannerStart = false;
    }
    onVerticalVelocityChanged: {
      // Prevent triggering pulldown item when rebound from top boundary.
      if (verticalVelocity>0) bannerStart = false;
    }
    onMovementEnded: {
      bannerStart = false;
      // trigger timer to hide pull-down item 
      timer.restart();
    }
  }
}
This achieves what I want:
> Responsive pull-down with little delay, doesn't wait till focus is released to show.
> Don't trigger pull-down item when the list rebounds from top boundary.
> Don't trigger pull-down item when users start dragging at the top of the list downwards, then without releasing touch drag up to hit the top boundary.

The timer approach used by Tommi looks more flexible, but I didn't use use it because I am concerned about the power usage. But maybe I am wrong...