PDA

View Full Version : QScrollArea with transparent background



vrltwe
9th May 2014, 15:21
I would like to check if I'm doing it correctly. Advises are welcome.

I have a set o widgets which I want to layout horizontally, as they are many and occupies lot of space I use a QScrollArea to accommodate them.

Then I put the QWidget which has the QScrollArea in another QWidget.

And finally, that last QWidget is inserted in a QTabWidget.

The problem I see is:

The tabWidget has a white background and the scrollAreaWidgetContents has a gray background. With the intention of solve this I tried ui->scrollAreaWidgetContents->setAttribute(Qt::WA_TranslucentBackground), but all the scrollArea contents get trashed when moving the scroll.

wysota
12th May 2014, 09:49
What exactly is the effect you want to obtain? Do you wish to get rid of the gray background?

vrltwe
12th May 2014, 12:07
Yes, exactly.

wysota
12th May 2014, 12:29
Did you try setting the background color to Qt::Transparent or making sure autofillBackground is set to false? In general I tried to repeat the problem you are having using Qt Designed but everything works for me as expected. Can you provide a minimal compilable example reproducing the problem?

vrltwe
12th May 2014, 13:19
Please find a compilable example attached.

I tried both. Setting the background color to Qt::Transparent makes even the buttons and scrollbar transparent, which I didn't want.