def show_list(self, data) : for i in range(len(data)) : item = QListWidgetItem(self.listWidget) row = Item(data[i]) item.setWhatsThis(str(i)) item.setSizeHint(row.sizeHint()) self.listWidget.setItemWidget(item, row) self.listWidget.addItem(item) self.itemList.append(item) self.rowList.append(row)
def show_list(self, data): remainP = [ '100개 이상', '30개 이상 100개 미만', '2개 이상 30개 미만', '1개 이하', '판매중지' ] for i in range(len(data)): item = QListWidgetItem(self.listWidget) row = Item(data[i]) rs = data[i].get('remain_stat') if rs == None: row.remain_stat.setStyleSheet('color:red') elif remainP.index(rs) <= 1: row.remain_stat.setStyleSheet('color:green') elif remainP.index(rs) == 2: row.remain_stat.setStyleSheet('color:orange') else: row.remain_stat.setStyleSheet('color:red') item.setWhatsThis(str(i)) item.setSizeHint(row.sizeHint()) self.listWidget.setItemWidget(item, row) self.listWidget.addItem(item) self.itemList.append(item) self.rowList.append(row)