def __init__(self, typenames, title="", parent=None): super().__init__(parent) self.setWindowTitle(title) self.layout = QtWidgets.QVBoxLayout(self) self.qlis = QtWidgets.QListWidget(self) self.create = QtWidgets.QPushButton("Create", self) self.cancel = QtWidgets.QPushButton("Cancel", self) self.layout.addWidget(self.qlis) self.layout.addWidget(self.create) self.layout.addWidget(self.cancel) for typename in typenames: item = QtWidgets.QListWidgetItem() item.setText(typename) item.typename = typename self.qlis.addItem(item) self.create.clicked.connect(lambda: self.done(1)) self.cancel.clicked.connect(lambda: self.reject()) self.clear()
def makeWidget(self): self.widget = QtWidgets.QListWidget() self.widget.setSelectionMode( QtWidgets.QAbstractItemView.MultiSelection) self.updateWidget()
def makeWidget(self): # Creates the root QtWidget. Adds subwidgets. self.widget = QtWidgets.QListWidget()