(self, image)
| 170 | self.bigView = BigImageView(background='#323232') |
| 171 | |
| 172 | def addItem(self, image): |
| 173 | if isinstance(image, str): |
| 174 | image = QPixmap(image) |
| 175 | # 添加一个item |
| 176 | item = QStandardItem() |
| 177 | # 记录原始图片 |
| 178 | item.setData(image, Qt.UserRole + 1) # 用于双击的时候取出来 |
| 179 | # 缩放成小图并显示 |
| 180 | item.setData(image.scaled(60, 60, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), Qt.DecorationRole) |
| 181 | # 添加item到界面中 |
| 182 | self.dmodel.appendRow(item) |
| 183 | |
| 184 | def count(self): |
| 185 | return self.dmodel.rowCount() |