PDA

View Full Version : Cancel effect from parent qwidget



Wong
12th April 2011, 10:22
Hi,
If parent qwidget set a QGraphicsEffect, child qwidget will inherit that effect.
Can I cancel child qwidget's effect?:(

:confused:Title...seems to be wrong

sezaru
8th May 2011, 20:08
Hello guys,

First, this is my first post and I know I'm resurrecting this post, but this is exactly my question so I though it would be better to use this post than create a new one with the exactly question.

So.. The question is the same, I have some QGraphicsPixmapsItems childs with an QGraphicsItem parent, when someone clicks on one of the childrens, the parent effect is set to blur, so all it's childres (including the one I have clicked) are affected by the blur effect, what I want is to cancel the effect on this children, I'm posting an image so you guys can see better what I'm trying to do!

This is what i get now:
6386

This is what I want to get:
6387

Thanks in advance and sorry about my bad english.

wysota
8th May 2011, 23:20
The whole point of effects is that children inherit them. If you don't want some item to inherit an effect from its parent then don't make it a child of that parent.

sezaru
8th May 2011, 23:48
Thanks for the reply, but as you can see in the image I uploaded, I'm trying to make an card game, the idea is that the cards at the bottom are the player deck, and when the player clicks in it, the card will scale and center on the scene, and all the rest of the scene will blur, so the card clicked got some "focus", but the thing is that all cards are children of the same parent so I just need an parentItem()->setGraphicsEffect(new QGraphicsBlurEffect()); and all the scene will be bluried instead of having to blur item by item, but obviously when I do this command the card that I need focus inherit the blur effect too.

So, I think it's not possible to do what I want right? Then what would be the best solution, I can thing in a solution, but it just sounds wrong to me:
I got the card with focus, do the command to blur the parent, remove the focused card from the parent GQraphicsItem so it will not inherit the blur anymore, then when i click it again (to return the card to the deck), I reasing the parent and remove the parent blur.
Is this the best solution?

Thanks a lot!

liversedge
3rd August 2011, 01:59
Anyone got any news on this?

I would have thought the whole purpose of QGraphicsEffect is to apply a graphics effect, the scope should be controllable. I can see that the API is pretty thin in this area and am wondering if to get a 'frame' effect it might be better to do it myself during a paintEvent.

Anyone done this before?

Added after 1 10 minutes:

scratch that, I did it but the QGraphicsDropShadowEffect is dog slow. Its not ready for prime time.