[Interest] QTextEdit and Style sheets

Christoph Feck christoph at maxiom.de
Tue Mar 13 17:26:59 CET 2012


On Tuesday 13 March 2012 16:52:21 André Somers wrote:
> Op 13-3-2012 16:45, Graham Labdon schreef:
> > Hi everyone
> > 
> > Solved this!
> > 
> > edit->setStyleSheet("background-image:url(:/images/bg.jpg)");
> > 
> > QPalettepalette=edit->palette();
> > 
> > palette.setBrush(QPalette::Base,Qt::NoBrush);
> > 
> > edit->setPalette(palette);
> 
> Please report this as a bug. I think that setting a background
> image should already set the brush to NoBrush, or the rendering
> should be done the other way around. Either way, that would
> qualify as a Qt bug IMO.
> 
> André

You have to change the background of the viewport() instead, otherwise 
the viewport will render its background over that of the QTextEdit 
object. So it is not a bug, but expected behavior. Using setPalette() 
also affects the viewport, because the palette attribute is inherited 
by children.

-- 
Christoph Feck
http://kdepepo.wordpress.com/
KDE Quality Team



More information about the Interest mailing list