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. Passing QML model
Qt 6.11 is out! See what's new in the release blog

Passing QML model

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 562 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.
  • M Offline
    M Offline
    MartinD
    wrote on last edited by MartinD
    #1

    Hi,
    I have a QML component (it is a form which will edit user details). It exposes user property, where currently edited user sits:

    // UserEdit.qml
    
    Rectangle {
        property alias user: editedUser
    
        User {
            id: editedUser
        }
    }
    

    Then I have javascript code which should pass the user I wish to edit to the edit form:

    UserEdit{
       id: userEdit
    }
    
    // some components come here
    
    onClicked: {
       userEdit.user = model
    }
    

    However, during the assignment in onClicked event, I get:

    TypeError: Cannot assign to read-only property "user"
    

    How to pass the user to the edit form?

    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