I am using the following code to move a single item up in the PyQt6 list widget
def move_item_up_in_list_box(self):
row = self.listWidget.currentRow()
text = self.listWidget.currentItem().text()
self.listWidget.insertItem(row-1, text)
self.listWidget.takeItem(row+1)
self.listWidget.setCurrentRow(row-1)
But I couldn't find an option to get the index positions when multiple lines are selected, though 'self.listWidget.selectedItems()' returns the texts in the selected items, I couldn't figure out how to move multiple lines up or down.