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:

    !http://i.stack.imgur.com/wkMDc.png(gray 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();
    (...)
    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.@


  • 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.

    BUT.

    This property doesn´t work on XP. I put white background instead.

    AND.

    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)

    What?

    I want to see the white panel color...



  • Any answers?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.