Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Mystery property with ListViews

Mystery property with ListViews

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 467 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    treaves
    wrote on last edited by
    #1

    I'm learning QML. I'm playing with an application that uses a ListView, and I'm using a delegate and a model. I was figuring out how to get something done, and in doing so, I came across this code:

    list_view1.currentIndex = index
    

    This code resides in the delegate. It sets the currentIndex property of ListModel instance to the current items index.

    They question is, where is the property index coming from?

    Originally my delegate was just a separate QML file with an Item{}, and this code (in context of course) worked. It set the index to the current delegate. But I can find no index property in Item. And I've read the documentation for ListView, and it mentions nothing like this either.

    Any pointers appreciated.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      treaves
      wrote on last edited by
      #2

      I finally found a reference to the index 'role' in http://doc.qt.io/qt-5/qtquick-modelviewsdata-modelview.html .

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved