[Qt-interest] make QScrollArea transparent

Mildred Ki'Lya ml.mildred593 at gmail.com
Fri Feb 6 16:55:19 CET 2009


2009/2/6 <wim.delvaux at adaptiveplanet.com>

> Could it be that stylesheets are not used that way ?
>
> Have you tried to set the BGC of the parent to something simple using e.g.
> setBackgroundRole call ?


Well, thanks for the answer.

I tried as you said, removing the style and then on the parent (frame) set a
background role:

frame.setBackgroundRole(ColorRole.Shadow);

Now, the scroll area is the right color (some black) but the parent still
has the default gray of the window. It hasn't changed its background. I
don't know why.

Anyway, I used another technique to achieve my goal. I wanted to display a
text on several lines and be able to scroll it if needed. Instead of putting
a label in a scroll area, I simply used QPlainTextEdit:
- in read only mode
- with no frameShape (NoFrame)
- with a transparent background color. I simply used the following style
sheet:

#content {

background-color: rgba(255, 255, 255, 0);

}


Now that I write this e-mail, I realize that the same works for the scroll
area. Just set a transparent background color :)



Mildred
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090206/4dcfed3a/attachment.html 


More information about the Qt-interest-old mailing list