문제

I must have a gesture ability on left and right swipe but i need to also display a list view but as soon as do do I look the ability to swipe left and right. How would you deal with this problem?

This is a small code snippet from my program.

CustomGestureArea{

     onSwipeRight:{
        // do something
     }
     onSwipeLeft:{
        // do something
     }
     // as soon as i put this in i loose the swipe functionality
     ListView{
          anchors.fill:parent
     }

}

I was thinking about making another custom gesture class which would include a list view and I would set property aliases for the model and other needed info for the list view to work as normal, but on the swipe up and down it would scroll the list (as one would expect with the normal list view functionality). But I have no idea how to even get started. My idea was something list this.

GestureAreaListView{

     property alias list_model:list.model
     // and all other needed properties etc
     onSwipeRight:{
        // do my custom function
     }
     onSwipeLeft:{
        // do my custom function
     }
     onSwipeUp:{
        // do List view scroll up
     }
     onSwipeDown:{
        // do List view scroll down
     }
     // as soon as i put this in i loose the swipe functionality
     ListView{
          anchors.fill:parent
     }
     ListView{
          id: list
     }
}
도움이 되었습니까?

해결책

By doing so, your ListView is on top of your CustomGestureArea, thus it take event.

You could force zOrder to make it on top.

But you should try simply to inverse who's on top of who :

ListView{

    CustomGestureArea{
        anchors.fill:parent
        onSwipeRight:{ // do something 
        }
        onSwipeLeft:{ // do something
        }
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top