PDA

View Full Version : Remove shadow of child widgets? Like a sunken frame...



new_voodoo
13th December 2010, 23:31
Hi.

If I include a widget w1 into a layout of a parent widget pw, the widget w1 is getting drawn with a shadow of its frame, or in other words, it is drawn like sunken into the parent widget pw.

I would like to have the inner widget w1 at the same level as the parent widget pw so that there is no "sunken" effect!

I tried QFrame and played around, but no matter what frame style I use, the widget looks still the same.

So how can I do this?

Thanks

P.S.

I do a simple paint(just background filling) with a QPainter in the paintEvent method of the inner widget w1.
Maybe it has something to do with the painter object to get rid of the sunken border/frame of that widget.

I draw a rect with the painter method drawRect() that creates the sunken effect. If I use the fillRect() method, the sunken effect is gone.

So how can I draw the rect with drawRect() without the sunken effect?



void InnerPaintWidget::paintEvent( QPaintEvent* pe )
{


QPainter p(this) ;

QBrush br(Qt::green) ;
QPen pen( Qt::red ) ;
pen.setStyle( Qt::DotLine ) ;

p.setBrush( br ) ;
p.setPen( pen ) ;
//p.setBackground( br ) ;
//p.fillRect( this->rect(), br ) ; // without sunken effect at the borders



QRect ri = this->rect() ;
p.drawRect( ri ) ; // with sunken effect at the borders

QLabel::paintEvent( pe ) ;
}