pyqt pyside QPushButton 图标(icon)大小自适应设置
img = QtGui.QImage(r'd:/test.png')
pixmap = QtGui.QPixmap(img)
fitPixmap = pixmap.scaled(64, 64, QtCore.Qt.IgnoreAspectRatio, QtCore.Qt.SmoothTransformation) #注意 scaled() 返回一个 QtGui.QPixmap
icon = QtGui.QIcon(fitPixmap)
btn = QtWidgets.QPushButton()
btn.setIcon(fitPixmap)
btn.setIconSize(64, 64)