PDA

View Full Version : How do I use QGraphisDropShadowEffect on a widget?



Waleed95
20th December 2011, 15:42
Should I just put the function in the .cpp file along with the name of the widget?
Like :


QGraphicsDropShadowEffect QGraphicsDropShadowEffect (HWChatWidget);

Help would be appreciated.

Spitfire
21st December 2011, 15:01
You need to apply the effect to a widget.
Parent is not the widget that the effect is applied to, but the efect will be deleted with the parent.


QWidget* w = new QWidget(this);
w->setFixedSize( 100, 100 );
w->setStyleSheet( "background-color:red;");

QGraphicsDropShadowEffect* e = new QGraphicsDropShadowEffect(w);
e->setBlurRadius( 10 );

w->setGraphicsEffect( e );