MCPcopy
hub / github.com/PyQt5/PyQt / addItem

Method addItem

QListView/ImageView.py:172–182  ·  view source on GitHub ↗
(self, image)

Source from the content-addressed store, hash-verified

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()

Callers 15

__init__Method · 0.45
initMapMethod · 0.45
__init__Method · 0.45
dropEventMethod · 0.45
setupUiMethod · 0.45
testMethod · 0.45
__init__Method · 0.45
testMethod · 0.45
__init__Method · 0.45
setupUiMethod · 0.45
getAvailablePortsMethod · 0.45
setupUiMethod · 0.45

Calls 2

appendRowMethod · 0.80
setDataMethod · 0.45

Tested by 1

testMethod · 0.36