Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
I can´t get a widget to transparent or background color
I have a widget which background is not transparent but gray as you can see in this image:
I have a custom widget with a layout and this
ScrollAreainside with this style:
margin: 5px; /so it appears with 5 px around. the scroll bar is separated then/
Inside a generic
QWidgetfor the viewport to see (setWidget) with this style:
@background: transparent; // <---- HERE IS THE PROBLEM
If i try a color and not transparent, it doesn´t work. Always gray.
I also tried setAutoFillBackground(true) but didn´t work. (doesn´t work, anyway with styles).
The code for those two containers is this:
@cameraModeParametersPanel_ = new QScrollArea(); (...) cameraModeParametersPanel_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); cameraModeParametersPanel_->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); cameraModeParametersPanel_->setWidgetResizable(true); mainParametersLayout->addWidget( cameraModeParametersPanel_ ); // the panel QWidget* paramPanelViewportWidget = new QWidget(); (...) QVBoxLayout* mainCameraLayout = new QVBoxLayout(paramPanelViewportWidget); (...) // and then i add QGroupBoxes with titles.@
Sam last edited by
You can have a look at "this":https://qt-project.org/forums/viewthread/22836/ thread.
But it is NOT a custom widget. It´s a QWidget without any class. It´s created and used in the same line, as you can see.
I´ll try that... but i don´t see why doesn´t it work.
Yeah it works.
This property doesn´t work on XP. I put white background instead.
The panel that contains the ScrollArea has white background, and the zone of the scroll area is TRANSPARENT. I see what is behind the panel containing it. O_O (i mean, the blue background behind)
I want to see the white panel color...