Model

class Model.Updater(get_uuid)
Arguments
  • get_uuid (function()) – Function to call to get an item’s UUID.

This objects allows update of a ListModel without resetting the whole model if only some items change.

.import fbx.data 1.0 as Data

var dmu = new Data.Model.Updater(function (item) {
    return item.id;
});
Model.Updater.Model.Updater.update(elements, model, compare_sort_fn, direct)
Arguments
  • elements (list()) – A list of items

  • model (ListModel()) – A reference to a list model to update to

  • compare_sort_fn (function()) – A function to call to compare position of two items

  • direct (bool()) – Whether update is direct or should use model.sync().

After this function is called, model will contain all items from elements, ordered by compare_sort_fn. Items that existed in model already will just get updated / moved.