Qt World Summit: Submit your Presentation

"Error: Cannot assign to read-only property" in delegate

  • Hi,
    Qt 4.8/Sailfish-Ubuntu
    I have two Listviews in QML.
    Both are set via C++ ():
    @rootContext()->setContextProperty("myCheckListHeadings", QVariant::fromValue(clHandling->checkListHeadings) );//data
    rootContext()->setContextProperty("myCheckListItems", QVariant::fromValue(clHandling->checkItems) );//data
    checkListHeadings.append(new CheckListItem(chked, clName));
    checkItems.append(new CheckListItem(chked1, line));
    chked, clName and chked1, line are valid bool(false)/QString values
    Both listviews are filled with the data from C++.
    Both listviews have delegates with:
    (MouseArea) Onclicked:
    @checked is true

    In the first list checked is indeed set to true,
    the second list generates error:
    Error: Cannot assign to read-only property "checked"

    I have seen bug reports on this issue, but it is unclear if it was solved.
    Also strange that one list is working OK, and the other fails.
    Any hints?

Log in to reply