Skip to content

Use the delegate's index to determine which item to move.

Ben Breslauer requested to merge benbreslauer/skanpage:fix-reordering into master

The index property of the delegate is the proper way to refer to the position of the item. Using listView.currentIndex is subtly wrong, because (I believe) it is only evaluated when the item is initially created and the delegate template is instantiated for that item. This meant that after moving an item, some of the buttons would act on other items.

As an example, say you have this list:

Scan1
Scan2
Scan3

If you pressed the down button on Scan1, it would become:

Scan2
Scan1
Scan3

And then, if you pressed the down button on Scan2, it would (incorrectly) become:

Scan2
Scan3
Scan1

But with this change, it correctly becomes:

Scan1
Scan2
Scan3

Merge request reports