我正在使用以下代码在 PyQt6 列表小部件中向上移动单个项目
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向下。