Problem applying QGraphicsBlurEffect to a QGraphicsPixmapItem
Hi all,
I try to apply blur to an image but nothing seems to happen and can't wrap my head arround whatmight be wrong here:
Code:
QGraphicsBlurEffect effect;
effect.setBlurHints(QGraphicsBlurEffect::QualityHint);
effect.setBlurRadius(5);
item.setGraphicsEffect(&effect);
item.pixmap().toImage().save("blur.png");
Re: Problem applying QGraphicsBlurEffect to a QGraphicsPixmapItem
Ehm, you are constructing an empty pixmap, and blur an empty pixmap results in an empty pixmap;) You might want to try
And also I think that the pixmap function of the item returns the unmodified source pixmap of the item. But I am not sure on that. So if you want save it you have to render the scene or set the pixmap to a label and render that back to a pixmap.
Re: Problem applying QGraphicsBlurEffect to a QGraphicsPixmapItem
Nope it ain't an empty pixmap. But you hit a point, how could I render it as it's offscreen?
Re: Problem applying QGraphicsBlurEffect to a QGraphicsPixmapItem
You will probably have to add your item to a QGraphicsScene, which you can then render() off-screen using your own QPainter. See also QGraphicsView::render() for off-screen rendering and some examples related to printing.