问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/19309151/qgraphicsblureffect-on-parent-widget-only