PDA

View Full Version : Creating semitransparent widget over QGraphicsView



Luc4
24th March 2010, 09:40
Hi! I'm trying to overlap a transparent widget to a QGraphicsView. I created it with:


MyWidget* widget = new MyWidget(this);
widget->show();

and I noticed it results not to be semitransparent. If, instead, I create it in a subclass of the QGraphicsScene placed in the QGraphicsView whose parent is my QMainWindow, like:


MyWidget* widget = new MyWidget((QWidget*)this->parent());
widget->show();

I get that it is semitransparent. Why?
Thanks!

aamer4yu
24th March 2010, 09:52
What is 'this' in the first code ?

Luc4
24th March 2010, 10:06
'this' in the first code was referring to my subclass of the QGraphicsView. Now I managed to get it work, but unfortunately I don't know how... I must have changed something while hacking and now seems to work in both the ways I reported.
Anyway, I noticed transparency doesn't work in case the widget is created with a NULL parent: is this correct?
Thanks for your time!