Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt Designer QListWidget checkbox

I am using PyQt4 and Qt Designer. I have a QListWidget in which I populate after loading a file in my program.

I want to set it so that all items will be checkable, as opposed to just selectable. I have found online that this is a 'flag' of the QListWidget, however, in Qt Designer I can't see where to do this.

Is it possible?

like image 352
user-2147482637 Avatar asked Mar 12 '14 02:03

user-2147482637


1 Answers

You can do this by opening the edit list widget item tab , and look into 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)
like image 57
thecreator232 Avatar answered Oct 06 '22 13:10

thecreator232