Skip to content

Fix binding to temporary object due to auto-converted loop variables

There is no reason for the loop variables to be of type QPersistentModelIndex, as they are used and copied to the class member as QModelIndex type in the loop body only.

So changing the reference type to match the looped list element type also fixes the current resulting binding to a temporary object.

Not that experienced myself with persistence model indexes, so might have missed out some details, so needs an QAIM expert to check :) Found while researching the reason for a similar code for which I then came up with the same fix proposal in pim/eventviews!35 (merged)

@dfaure

And now noticed b44d754c does a similar change, just that there a full copy is needed due to being modified in the loop body.

Edited by Friedrich W. H. Kossebau

Merge request reports