Pyqt5 qlistwidget select multiple instances and return


Refer to stack overflow Python: how to query multiple selected items in qlistwidget in pyqt

from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
listItem = ['a','b','c','d','e']
if listItem is not None and len(listItem) > 0:
      self.listWidget = QListWidget(self)
      for item in listItem:
      if multiselected:
        Self.listwidget.setselectionmode (qabstractitemview. Extendedselection) ා hold Ctrl to select multiple
      # self.listWidget.itemClicked.connect(self.listItemClick)
      # self.listWidget.itemDoubleClicked.connect(self.listItemDoubleClick)
text_list = self.listWidget.selectedItems()
text = [i.text() for i in list(text_list)]  
Text = '', join (text) ා text means multiple options and separated by #

The above example that pyqt5 qlistwidget selects multiple items and returns is all the content that Xiaobian has shared with you. I hope it can give you a reference, and I hope you can support developer more.