def changeIcon(self):
icon = QIcon()
for row in range(self.imagesTable.rowCount()):
item0 = self.imagesTable.item(row, 0)
item1 = self.imagesTable.item(row, 1)
item2 = self.imagesTable.item(row, 2)
if item0.checkState() == Qt.Checked:
if item1.text() == "Normal":
mode = QIcon.Normal
elif item1.text() == "Active":
mode = QIcon.Active
elif item1.text() == "Disabled":
mode = QIcon.Disabled
else:
mode = QIcon.Selected
if item2.text() == "On":
state = QIcon.On
else:
state = QIcon.Off
fileName = item0.data(Qt.UserRole)
image = QImage(fileName)
if not image.isNull():
icon.addPixmap(QPixmap.fromImage(image), mode, state)
self.previewArea.setIcon(icon)
评论列表
文章目录