Difficulty with ListView (or GridView) choking with binding on large listmodels

, ,

I was experimenting with a GListModel (in this case a GListStore) with a large number of objects. Here is a small demo that shows the choking I’m talking about – if you click on an item or scroll down, items disappear. I can’t tell if I’m doing something wrong or missing something obvious. Any suggestions appreciated!

Here is a small testcase with a ListView, but the same thing happens with a GridView.

This one caught me for a while too when porting Builder’s project tree to GtkListView.

The problem is that you have a scrolled window containing your widget, which then contains the listview. That means that the listview cannot control the adjustments directly on the scrolled window. What happens is that you now have a hierarchy like:

  • ScrolledWindow
    • Viewport
      • your-widget
        • listview

Just put the listview inside the scrolled window directly and your issue should go away.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.