Hi Oleksii, After writing the code I realized that RemorseItem by default excecutes its executable onDestruction() when its timer is on. I am not quite sure why it didn't work the same way before or why I precieved it differently.
Thanks again Kris On 14 October 2014 08:46, Oleksii Serdiuk <conta...@oleksii.name> wrote: > Hi Kris, > > Aha! So what you want is: > > 1. User selects to remove an item in the ListView. > 2. RemorseItem activates so user can cancel the deletion. > 3. When timer times out, the item is actually deleted from the model. > > And, in this case, 3. breaks when user scrolls the item away before > timeout: delegate is deleted -> RemorseItem never times out -> item not > deleted from the model. > > Then yes, performing deletion in Component.onDestruction() is the way > Jolla's standard apps do (at least I've seen it in one of their apps). > So you're on the right track :-) > > On 13/10/14 23:54, Krisztian Olah wrote: > > Hi Oleksii, > > It is the model that handles the actual removal, but I want a > > RemorseItem to call it, which is in return requested by the delegate. I > > want all list items to have their own remorse timer in case user wants > > to cancel one but not the other. > > In my current version it works fine, except when the user scrolls away > > too far the RemorseItem is destroyed and the file is left on the disk, > > but come to think of it; perhaps I could just call the model.remove() > > function when onDestruction() signal is emitted. Thanks, if I didn't > > write this letter I might not think of it. :) > > > > Anyway if you want to see the latest version you can have a look here: > > > https://github.com/KrisztianOlah/london-sail/blob/devel/qml/pages/MyMapsPage.qml > > > > I'd be happy for any feedback. :) > > > > Thanks Kris > > > > On 13 October 2014 20:10, Oleksii Serdiuk <conta...@oleksii.name > > <mailto:conta...@oleksii.name>> wrote: > > > > Hi Kris, > > > > If I understood you right, why do you try to remove list elements > > directly from the ListVie. You should be removing them from the > > model and it will also remove components from the list. > > > > See > > http://qt-project.org/doc/qt-__5/qml-qtqml-models-listmodel.__html > > <http://qt-project.org/doc/qt-5/qml-qtqml-models-listmodel.html> > > > > You can access ListView's model through its 'model' property: > > > > > listView.model.remove(index); > > > > > > If you'd like to animate the removal, set 'remove' property of > > ListView (SilicaListView is based on ListView) to some transition > > animation. > > > > > http://qt-project.org/doc/qt-__5/qml-qtquick-listview.html#__remove-prop > > < > http://qt-project.org/doc/qt-5/qml-qtquick-listview.html#remove-prop> > > > > > > That would be a "proper" way to do it :-) > > > > > > > > On 10.10.2014 17:00, Krisztian Olah wrote: > > > > Hi everyone, > > > > I need some help between choosing ListView or Repeater. > > I've got a SilicaListView whose elements I want to remove(only > > remove, > > never add) dynamically from GUI. When I have fairly a long list > > count(~25), reaching the element with > > ListView.contentItem.children[__index] is not possible for the > > mid to end > > of the list, probably because ListView destroys items that are > not > > visible. When that happens children[index] will not refer to the > > same > > element as model.index and therefore I cannot call remove() on > > the item. > > Using a Repeater would of course prevent this, but I don't think > > I can > > have a RemoveAnimation and I think I would have to reset the > model. > > > > Is there another way that I didn't think of that would allow > > me to > > remove items from my model with animation and would allow me to > > have a > > list up to 1000 members(in real use it will probably be under > > 100) long? > > > > Thanks in advance > > Kris > > -- > With best regards, > Oleksii Serdiuk > > > _______________________________________________ > SailfishOS.org Devel mailing list > To unsubscribe, please send a mail to > devel-unsubscr...@lists.sailfishos.org >
_______________________________________________ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org