This thread is 6 years old but appears in Google, so I'll hint to the probable solution for future readers.

If you move items the way you do it, you will invalidate your view's internal persistentModelIndices for selected items, current item etc. Next time such a persistent index will be fed to your model's data() function, it will segfault.

For sorting / rearranging items you need to either
Qt Code:
  1. beginResetModel();
  2. sortItems();
  3. endResetModel();
To copy to clipboard, switch view to plain text mode 
or
Qt Code:
  1. for(row in all items) {
  2. toRow = sortRow(row); // or whatever
  3. beginMoveRows(row, toRow);
  4. moveItem(row, toRow);
  5. endMoveRows();
  6. }
To copy to clipboard, switch view to plain text mode