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. Accessig StackView current item's properties by id

Accessig StackView current item's properties by id

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

    Ok we have

    RootComponent {
       StackView {
          id: stack
          initialItem: itemWrapper
          ...
       }
       Component {
          id: itemWrappr
          Item {
                id: item1
                ...
          }
       }
       RandomButton {
          onClicked: {
             item1.prop =  "hello World";
          }
       }
    }
    

    we get refference error. Why and what is the approach to overcome this. How to access Component's properties?

    M 1 Reply Last reply
    0
    • K Kofr

      Ok we have

      RootComponent {
         StackView {
            id: stack
            initialItem: itemWrapper
            ...
         }
         Component {
            id: itemWrappr
            Item {
                  id: item1
                  ...
            }
         }
         RandomButton {
            onClicked: {
               item1.prop =  "hello World";
            }
         }
      }
      

      we get refference error. Why and what is the approach to overcome this. How to access Component's properties?

      M Offline
      M Offline
      medyakovvit
      wrote on last edited by
      #2

      @Kofr

      itemWrappr.prop =  "hello World";
      
      1 Reply Last reply
      0
      • L Offline
        L Offline
        literA2
        wrote on last edited by
        #3

        To access the stackview current item's property, you need to use this:

        stack.currentItem.property
        
        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