Example project how to use backbone.js and zepto.js with Qt/QML
JavaScript C++
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
images
js
qml
.gitignore
LICENSE
QmlBackboneTodo.pro
README.md
deployment.pri
main.cpp
qml.qrc

README.md

qml-backbone-todo

Example project how to use backbone.js, underscore.js and zepto.js with Qt/QML QT/QML Backbone.js Todo

This example uses Enginio Data Storage as database. Please see more information Qt Cloud Services

Usage

Use Backbone models and collections as usual

// app.js
var baseUrl = "https://api.engin.io/v1";
var Todo = Backbone.Model.extend({

});

var TodosCollection = Backbone.Collection.extend({
    model: Todo,
    url: baseUrl+"/objects/todos",

    parse: function(response) {
          return response.results;
    }
});
//main.qml
function completeItem(index) {
    var todo = App.todos.at(index)
    todo.save({completed: true}, {success: function(model) {
        todoModel.setProperty(index, "itemProcessing", false);
    }, error: function(){ console.log("error")} } )
    todoModel.set(index, todo);
}

Listen events in QML file

//main.qml
ListModel {
    id: todoModel
}

Component.onCompleted: {
    App.todos.on("add", function(todo) { todoModel.append(todo) });
    App.getTodos();
}