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. obtaining the index from a ListView delegate
Forum Updated to NodeBB v4.3 + New Features

obtaining the index from a ListView delegate

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 710 Views
  • 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.
  • K Offline
    K Offline
    kgregory
    wrote on last edited by
    #1

    According to the ListView documentation, I should be able to grab the index number belonging to each index. What I want to do is display that number as text on each delegate item. The ListView documentation isn't very clear on how to get it (or maybe I'm just dense). Can anyone help?

    E 1 Reply Last reply
    0
    • K kgregory

      According to the ListView documentation, I should be able to grab the index number belonging to each index. What I want to do is display that number as text on each delegate item. The ListView documentation isn't very clear on how to get it (or maybe I'm just dense). Can anyone help?

      E Offline
      E Offline
      Eeli K
      wrote on last edited by
      #2

      @kgregory It should be as simple as using 'model.index' (or just 'index' if there's no name clashing inside the delegate). It's not ListView specific but can be found in the more general model/view documentation, at least in "Models and Views in Qt Quick". The ListView itself gives only 'ListView.isCurrentItem' attached property.

      1 Reply Last reply
      1
      • K Offline
        K Offline
        kgregory
        wrote on last edited by
        #3

        that worked, thanks!

        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