문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top