PDA

View Full Version : QGraphicsView no refreshement



evergreen
31st May 2011, 10:41
Hi,
I’m currently working with a QGraphicsView and I encounter some problems either when I try to put a transparent object over it or try to apply a blur effect.
I ‘m pretty sure that the reason is the same : the QGraphicsView always refreshes its display which messes with the transparency and the blur effect probably instantly desappear.

So, I would like to know if there’s a way to temporary stop a QGraphicsView (or the QGraphicsScene in it) to refresh. To somehow freeze its display.

Thanks

MarekR22
31st May 2011, 10:51
You have done something wrong! Show your code!

evergreen
31st May 2011, 11:12
Well I got about 50 files so it's gonna be complicated, but If you just create a QGraphicsView and apply a blur effect on it, it does not work.


QGraphicsView* graph = new QGraphicsView;
QGraphicsBlurEffect *effect = new QGraphicsBlurEffect() ;
graph->setGraphicsEffect(effect);

Note that it perfectly works on classical widgets. Taht's why I think QGraphicsView is the problem and it's because of it's refeshments.

wysota
31st May 2011, 11:32
So you are stacking two views one over another? Isn't it easier to just add the items from this additional view to the original scene?

evergreen
31st May 2011, 11:46
Nope because in my application a view could be over two others thats why it's got to be over.

wysota
31st May 2011, 11:59
The problem is that's not how widgets work and if you want composition, it will be hard to obtain such an effect. Why do you need a view to be over two others? Why don't make them all a single view/scene?

evergreen
31st May 2011, 13:02
I want the user to be able to work on several subwindows, that way I use a QMdiArea and a QGraphicsView in each of them.
Then I want that when the user ask to pop up an option window over this QmidArea and blur all the rest of the application.

Maybe I'm just too ambitious...!

wysota
31st May 2011, 13:42
I fail to see how this requires stacking graphics views onto each other.

As for bluring the background -- you should just make your dialog modal and leave handling the visual effects to the desktop system. I personally don't like when some application tries to convince me it knows better what's good for me. If I want blocked windows blurred, I'll set it up in my window manager.