Question

I'm trying to show a widget on top of another and apply the QGraphicsBlurEffect only on the parent like this

MyWidget::MyWidget(QWidget* parent) :
QWidget(parent),
{
    QGraphicsBlurEffect* effect = new QGraphicsBlurEffect(this);
    parent->setGraphicsEffect(effect);
}

But the result is both widget are blur.

It seams like the effect is propagated to the childrens.

How can I apply the blur effect on the parent only?

Was it helpful?

Solution

Your best option would be to break the parent-child relationship. There's no flags like QGraphicsItem's ItemIgnoresParentOpacity for QGraphicsEffects.

Another solution would be to copy the ItemIgnoresParentOpacity mechanism and implement it for QGraphicsEffect, but I don't think it's worth the trouble.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top