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. How to control enabled property of items in a ListView
Qt 6.11 is out! See what's new in the release blog

How to control enabled property of items in a ListView

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

    How can I control the enabled state of an item in a ListView upon construction of the ListView? In other words, given some list of things how do I determine which of those things the user should be able to click and which they shouldn't when the list first loads?

    ODБOïO 1 Reply Last reply
    0
    • R RobM

      How can I control the enabled state of an item in a ListView upon construction of the ListView? In other words, given some list of things how do I determine which of those things the user should be able to click and which they shouldn't when the list first loads?

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      @RobM hi
      every item has a property called index in the ListView, you can use that property

      enabled : index!==0 // here the first item is disabled
      
      1 Reply Last reply
      0
      • R Offline
        R Offline
        RobM
        wrote on last edited by
        #3

        Ahh I see okay thank you!

        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