Important: Please read the 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:

    ! background)!

    I have a custom widget with a layout and this ScrollArea inside with this style:

    @background-color: white;
    margin: 5px; /so it appears with 5 px around. the scroll bar is separated then/
    padding: 0px;@

    Inside a generic QWidget for the viewport to see (setWidget) with this style:

    @background: transparent; // <---- HERE IS THE PROBLEM
    margin: 0px;
    padding: 0px;@

    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();
    mainParametersLayout->addWidget( cameraModeParametersPanel_ );  // the panel
    QWidget* paramPanelViewportWidget = new QWidget();
    QVBoxLayout* mainCameraLayout = new QVBoxLayout(paramPanelViewportWidget);
    // and then i add QGroupBoxes with titles.@

  • You can have a look at "this": 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...

  • Any answers?

Log in to reply