PDA

View Full Version : QWidget overrides Qscrollarea CSS color setting



danielvianna
1st October 2015, 19:06
I'm trying to implement a complex UI in QT with a lot of customization.

This is what I'm trying to achieve (photoshop file)

11408

This is my current screen, I just discovered that the original CSS sheet which was developed by someone had a global color setting for Qwidget, this color is being rendered in a lot of widgets, but the problem is that it's overiding the Scroll, which prevents me from changing the color on the left side (please see the blue dot)

http://i.stack.imgur.com/8jYM8.png



The code for this is:

*****************************

QWidget {
background-color: #1a1d21; /* software canvas background color */
border: 0px solid black;
}

QScrollArea {
background-color: #262a30;
border: 1px solid black;
}

**************************

I tried removing the color code in the CSS for QWidget which effected Qscrollarea and the color chosen was properly rendered, but some problems came up:

It removed color for a lot of widgets that I had and now it's all white, now I will have to specify individually which worries me, because it's not just time consuming considering the size of my application but also because it sometimes it doesn't work.

11409

What also worries me is that I tried specifying background color to the specific widget and it didn't work, I've tried the placeholder object and class together and separated - QDockWidget / QDockWidget and also the real widget that is being called : QTabWidget / tabWidget. So I don't know whether it's because I'm doing something wrong in the code and not using still the correct object to change the color or if Qwidget is actually overriding the color (which makes me confused because I thought that child always overrides parent in CSS)

This is the placeholder
http://i.stack.imgur.com/bZiEm.png

Real widget
http://i.stack.imgur.com/7DJco.png

Note: I'm a designer and newbie in Qt and programming.