Forums

OverviewV-Play 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 4 years, 8 months ago.
    #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
    V-Play 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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support