← Back to team overview

touch-packages team mailing list archive

[Bug 1276118] Re: List Item onItemRemoved signal should provide the option to override its action with a custom one.

 

Hopefully the new ListItem will solve this issue for you.

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to ubuntu-ui-toolkit in
Ubuntu.
https://bugs.launchpad.net/bugs/1276118

Title:
  List Item onItemRemoved signal should provide the option to override
  its action with a custom one.

Status in ubuntu-ui-toolkit package in Ubuntu:
  Confirmed

Bug description:
  The title is a bit ambigious, let me try to explain in more detail
  here. I have been using U1db documents in a listview to retrieve and
  display stored listitems. U1db allows you to delete documents by
  putDoc(value, docId). So I connected this with the listitem's swipe to
  delete method.

  delegate: ListItem.Standard {
      removable: true
      onItemRemoved: {
           db.putDoc("", docId)
      }
  }

  The problem here is that when the user swipes delete a delegate, the
  listview deletes the delegate which in turn also deletes the u1db
  document. This changes the u1db model which is noticed by the listview
  and tried to delegate again which is no longer available resulting in
  an error.

  QQmlVMEMetaObject: Internal error - attempted to evaluate a function in an invalid context
  file:///usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Components/ListItems/Empty.qml:459:9: QML ScriptAction: <Unknown File>:

  The solution here would be to provide a way to override the default
  action of the onItemRemoved signal. This way the deleting action is
  only performed once.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1276118/+subscriptions