I am using PySide2 to paint my widget. Everything works, but at one point inside my paintEvent, I want to take the result of my painting, apply a blur to it and then comp it with the original. Is this possible?
I read that QGraphicsEffect is only applicable to widgets, so I found something like this:
def applyEffectToImage(src, effect):
scene = QtWidgets.QGraphicsScene()
item = QtWidgets.QGraphicsPixmapItem()
item.setPixmap(QPixmap.fromImage(src))
item.setGraphicsEffect(effect)
scene.addItem(item)
res = QImage(src.size(), QImage.Format_ARGB32)
res.fill(Qt.transparent)
ptr = QPainter(res)
scene.render(ptr, QRectF(), QRectF(0,0, src.width(), src.height()) )
return res
but even with this, which allows me to call a QGraphicsEffect inside my paintEvent, because my initial source is QPainter(self), how can I convert this into a QImage?