Hide the highlight of a ListView while scrolling

前端 未结 1 1127
夕颜
夕颜 2020-12-21 05:34

I am building a Qt5 application based on Qt-Quick 2 for the UI. I have an issue while displaying a ListView with an highlight component. When I scroll the ListView the highl

相关标签:
1条回答
  • 2020-12-21 05:50

    As reported by the documentation:

    Note: Views do not enable clip automatically. If the view is not clipped by another item or the screen, it will be necessary to set clip: true in order to have the out of view items clipped nicely.

    Hence, what you are experiencing is a common behaviour and you should either 1) clip the view via other Items (e.g. a header Rectangle and a footer Rectangle with z:infinite or simply set the clip property to true, i.e.

    ListView{
       //...
       clip:true
       //...
    }
    

    Clipping has some perfomance disavantages which can greatly affect the application as it grows. Hence, its usage, especially outside the views scenario, should be evaluated carefully.

    0 讨论(0)
提交回复
热议问题