Fix binding to temporary object by auto-converted loop variable
There is no reason for persistentIndex to be of type QPersistentModelIndex so changing the reference type to match the persistentIndexes element type is the fix to do for the old code
Not experienced with persistent model indexes, but this is my best understanding of the situation. Though I am puzzled to see similar code in KItemModels also using QPersistentModelIndex, but I sense this might be due to same developer pool origin and code taking as templates?
unmaintained/kdepim@a70002b7 already contained the assumingly unneeded implicit conversion to QPersistentModelIndex and the binding to the temporary, so history of the code also had no other hints if there actually was a need for that conversion.