--- a/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCodeSelectionDialog.py Sat Mar 18 14:39:01 2017 +0100 +++ b/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCodeSelectionDialog.py Sat Mar 18 16:20:08 2017 +0100 @@ -9,6 +9,7 @@ from __future__ import unicode_literals +from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QDialog, QTreeWidgetItem from .Ui_CodeStyleCodeSelectionDialog import Ui_CodeStyleCodeSelectionDialog @@ -59,10 +60,12 @@ itm.setIcon(0, UI.PixmapCache.getIcon("namingError.png")) elif code.startswith("D"): itm.setIcon(0, UI.PixmapCache.getIcon("docstringError.png")) + itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) if code in codeList: - itm.setSelected(True) + itm.setCheckState(0, Qt.Checked) codeList.remove(code) - # TODO: change this to checkable items + else: + itm.setCheckState(0, Qt.Unchecked) self.codeTable.resizeColumnToContents(0) self.codeTable.resizeColumnToContents(1) self.codeTable.header().setStretchLastSection(True) @@ -77,8 +80,9 @@ """ selectedCodes = [] - # TODO: change this to checkable items - for itm in self.codeTable.selectedItems(): - selectedCodes.append(itm.text(0)) + for index in range(self.codeTable.topLevelItemCount()): + itm = self.codeTable.topLevelItem(index) + if itm.checkState(0) == Qt.Checked: + selectedCodes.append(itm.text(0)) return ", ".join(self.__extraCodes + selectedCodes)