Qt Designer QListWidget

I am using PyQt4 and Qt Designer. I have QListWidgetone in which I fill after loading the file into my program.

I want to set it so that all elements are checked, and not just by choice. I found online that it is a “flag” QListWidget, however in Qt Designer I don’t see where to do it.

Is it possible?

+4
source share
1 answer

You can do this by opening the widget tab of the edit list and view the properties. and set the checkState property.

enter image description here

** UPDATE **

item = QtGui.QListWidgetItem()
item.setText(QtGui.QApplication.translate("Dialog", x, None,    QtGui.QApplication.UnicodeUTF8))
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
item.setCheckState(QtCore.Qt.Unchecked)
self.listWidget.addItem(item)
+6
source

Source: https://habr.com/ru/post/1531262/


All Articles