QListWidget - iterator fix in QListModel::ensureSorted

This is a fix similar to 7ddf1b14ecc7e56ddcc78cc7057881d7925d20ff

Change-Id: I369f428252527a8c3326c0f23a1dc31b63f884f5
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>