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. Extracting state from a listview
Forum Update on Monday, May 27th 2025

Extracting state from a listview

Scheduled Pinned Locked Moved QML and Qt Quick
7 Posts 3 Posters 1.8k 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
    ReshmaS
    wrote on last edited by
    #1

    Hello, I have a listview with 15 items, and two different states. I would like to know the state of the listelement which is in use(onclicked event). How do I determine this. I tried the following
    @
    var n = model.get(index).Name
    console.log(n.state)

    @

    I get answer as "undefined."

    Reshma

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dmcr
      wrote on last edited by
      #2

      Try model.get(index).state

      dmcr

      1 Reply Last reply
      0
      • R Offline
        R Offline
        ReshmaS
        wrote on last edited by
        #3

        Nope.. the result is the same "undefined".

        Reshma

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dmcr
          wrote on last edited by
          #4

          Are the event catched in the delegate ? Then you can use directly state.
          If you are in the view, it should work....

          dmcr

          1 Reply Last reply
          0
          • R Offline
            R Offline
            ReshmaS
            wrote on last edited by
            #5

            unfortunately that does not get cached..

            Reshma

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dmcr
              wrote on last edited by
              #6

              Please post some code....

              dmcr

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Macro
                wrote on last edited by
                #7

                Can you please post your code. So that the other people can also give it a try...

                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