qtqmlqabstractlistmodel

How can I figure out if the current item is the last item in a section of a ListView


So when I am drawing my ListView items I am sorting them into sections. Each item in a section has a line as a separator from the next item. For the last item I don't want to draw this separator. How can I figure out if the current item which is drawing itself, is the last item in the section (not in the ListView!)?


Solution

  • So apparently ListView has attached properties called section,previousSection,nextSection. With these it is pretty easy to find out if the next or previous section is the same as the current section. If it is not the same, then it means it is the last item in the section.