When you set the current item, you set 1 item per time. So replacing the "old current index".

Instead of using listWidget->setCurrentItem, do this:

Qt Code:
  1. QListWidgetItem* item = listWidget->item(i);
  2. if (item) item->setSelected(true);
To copy to clipboard, switch view to plain text mode