Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. I can´t get a widget to transparent or background color
Forum Updated to NodeBB v4.3 + New Features

I can´t get a widget to transparent or background color

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    darkgaze
    wrote on last edited by
    #1

    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.@
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      Sam
      wrote on last edited by
      #2

      You can have a look at "this":https://qt-project.org/forums/viewthread/22836/ thread.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        darkgaze
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          darkgaze
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • D Offline
            D Offline
            darkgaze
            wrote on last edited by
            #5

            Any answers?

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved