PyQt graphicsView自适应显示图像
self.graphicsView.scene_img = QGraphicsScene()
self.imgShow = QPixmap()
self.imgShow.load(fileName)
self.imgShowItem = QGraphicsPixmapItem()
self.imgShowItem.setPixmap(QPixmap(self.imgShow))
#self.imgShowItem.setPixmap(QPixmap(self.imgShow).scaled(8000, 8000)) //自己设定尺寸
self.graphicsView.scene_img.addItem(self.imgShowItem)
self.graphicsView.setScene(self.graphicsView.scene_img)
self.graphicsView.fitInView(QGraphicsPixmapItem(QPixmap(self.imgShow))) //图像自适应大小