I have added some check-able QListWidgetItem and I have challenge setting the border color for the checkboxes. setForeground function only sets the color of the checkbox text. Any suggestion please.
This is my sample code creating the check-able QListWidgetItems:
watch_list = ["Protesters", "Local news staff", "Techfluencers"]
for category in watch_list:
self.checkBox = QtWidgets.QListWidgetItem(category)
self.checkBox.setFlags(self.checkBox.flags() | QtCore.Qt.ItemIsUserCheckable)
self.checkBox.setCheckState(QtCore.Qt.Unchecked)
self.checkBox.setForeground(QtGui.QColor('#FFFFFF'))
self.watchListslistWidget.addItem(self.checkBox)
I have tried
self.watchListslistWidget.setStyleSheet("""
QListWidget::item {
border:1px #FFFFFF
}
""")
But it sets the all background of the QListWidget to white.
I got it working by using indicator as follows:
self.watchListslistWidget.setStyleSheet("""
QListWidget::indicator{
border: 1px solid white;
}
""")