Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 1 Support › Flickable + Repeater + Model

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6969

    spike

    I’m trying to implement a listview and used your LevelSelectionScene.qml as a reference, but I can’t get it working properly.Everything works, except my model which points to a function which is a getValue call to my Storage. My storage currently contains

    one JSON.stringified object which I want to set to the model.

     

    FlickList.qml
    Flickable {
    id: flickable
    property alias model: repeater.model

    Repeater {
    id: repeater
    delegate: testDelegate
    model: loadListModel()
    onModelChanged: {
    console.debug(“something changes”)
    }
    }

    Component {
    id: testDelegate()
    Rectangle {
    width: 100; height: 200
    color: “black”
    border.color: “black”
    Text {
    text: repeater.model[0].name // returnsĀ  [undefined]
    font.family: defaultFont.name
    color: “white”
    }
    }
    }

    function loadListModel() {
    console.log(“loading “)
    return [parapendium.getValue(“test”)] // returns my object inside an array
    }
    }

    In some other .qml where I use the FlickList.qml component from above I call explicit:

    flickList.loadListModel() and my FlickList creates one object, but the properties inside the delegate can’t be resolved.

    Why has it to be that complicated? D:

     

     

    • This topic was modified 7 years, 5 months ago by  supaiku.
    #6975

    spike

    Forget what I said, I found the problem:

    Taken from storage.js line 122

     var rs = tx.executeSql('INSERT OR REPLACE INTO settings VALUES (?,?);', [key,JSON.stringify(value)]);

    There is JSON.stringify called again on the value which I already JSON.stringified. Passing a non-stringified object solves the problem.

     

    I think that should be mentioned in the documentation somewhere.

     

    #6987

    Christian
    Felgo Team

    Hi spike,

    great you found the issue – we’ll add this information to the next doc version!

    Thanks for reporting,

    Chris

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded