Questions about models in NotificationDelegate.qml

Christoph Feck christoph at maxiom.de
Wed Sep 4 09:07:13 UTC 2013


On Wednesday 04 September 2013 00:17:37 Marco Martin wrote:
> On Tuesday 27 August 2013, Christoph Feck wrote:
> > Hi,
> > 
> > Looking at the NotificationDelegate.qml file, I see several lines
> > that say "notificationsModel.remove(index)", fired from timers,
> > running animations etc.
> > 
> > Do QML models automatically make sure the index is still valid,
> > in other words, when e.g. the timer fires delayed, and another
> > item has been added or removed in the meantime, is the index
> > updated accordingly? Or worse, if the item has been removed for
> > other reasons, is the timer/animation automatically cancelled so
> > that remove() is not called again?
> 
> in that case the timer is inside the dellegate itself.
> 
> in the context of the delegate, index will always be the index
> associated to that delegate itself, and yes, it's always valid.
> 
> if there is a timer in the delegate that right now has index 3, but
> the index 2 gets removed from the index before the timer expires,
> the inex variable will automatically be changed to 2, continuing
> to point to the proper item.
> 
> on the other hand, if the index variable had been saved to another
> variable, that would have caused problems because that cpy
> wouldn't get updated, so could get incorrect, but doesn't seem to
> be the case.

Thanks for the explanation, Marco. I am trying to understand what the 
cause for bug 311871 is. If I understand you correctly, we are safe to 
assume it is an upstream bug?

Christoph Feck (kdepepo)


More information about the Plasma-devel mailing list