QT How to apply Style Sheet to columns - qt

I am creating a Qt GUI app and i can not apply color or style sheet to the columns tab in QTreeWidget (the white color in the picture below)
anyone can help to do that ?

My problem was solved using this code:
ui->treeWidget->header()->setStyleSheet("QHeaderView::section {\
color: black;\
padding: 2px;\
height: 40px;\
border: 0px solid #567dbc;\
border-left:0px;\
border-right:0px;\
background: #D7D7D7;\
}");

Related

QDockWidget Tab Stylessheet

How I can change these tabs at the bottom from the design? I just can't find the prefix needed to color the tabs to match my design.
Assuming that those tabs are part of a QTabWidget, you can either modify the stylesheet in Designer with something like this:
QTabBar:tab { color: white; border: 2px solid #00FFFF; background-color: gray;}
Or you can do it via code like this:
ui->tabWidget->setStyleSheet(QStringLiteral ("QTabBar:tab { color: white; border: 2px solid #00FFFF; background-color: gray;}"));
You would obviously need to change the colors in the example to the colors you would want. You should also read Customizing QTabWidget for more examples and the full reference of what is possible.

Codename One change color of Material Icons

I am using the new Gui Builder and would like to change the color and size of the Material icons in a button.
Is there a way to do this? I couldn't find anything related on the net and changing the button's font color does not seem to affect the color of the icon ...
Thanks in advance.
What I have so far is the css style :
mybutton {
background-color: lightgray;
border-radius: 4pt;
border: none;
box-shadow: 2pt 2pt 2pt 0px gray;
color: #ff0000;
font-family: "native:MainRegular";
font-size: 7pt;
margin-top: 5pt;
margin-bottom: 12pt;
padding-bottom: 2mm;
padding-top: 2mm;
text-align: center;
}
The material icons get the color and styling of the component they apply to including changing their color on press/disable. To change their color just customize the UIID of the component e.g. if the component UIID is MyButton just style the MyButton UIID in the designer to match the color you want for the icon.
Another way to change the color of the material icons is by adjusting the foreground color of Default Style, in the theme editor. But this only works when you don't activate the CN1 internal ccs support.

How change background color tooltip primefaces extension?

Hi community I have a problem trying to change the color of tooltip extension, it happens that I'm using PrimeFaces 5.1 and extension 3.0, using the thema of grinders pepper, but does not perform the change in white, I leave my code.
<pe:tooltip global="true" />
.ui-tooltip,.ui-tooltip .ui-widget-content {
border: 1px solid #9d9d9d;
color: #000000;
background-color: #ffffff;
}
Hope you can help me, thanks.
In the PF-ext showcase, there also is a background image. That overrides the color (per css standards). When I tried setting the background image to 'none'
.ui-tooltip, .ui-tooltip-content.ui-widget-content {
background-color: yellow;
background-image: none;
}
in the PF-ext showcase, it worked.

control the border of the frame and its components

I have a frame in qt qith some components in it. When I change the stylesheet the components in it also change, but i don't want this, as i'm changing only the border of the frame.
border-width: 1px;
border-style: inset;
border-color: #515c84
border-radius: 9px;
Also the border gets two colors and i don't know why.
Can anyone help me please?
The children widgets inherit the parent frame stylesheet. If you want to change the view of the frame only, use this stylesheet:
#frameObjectName {
border: 1px solid #515c84;
border-radius: 9px;
}
Where frameObjectName is the name of the frame.
The border gets two colors, because it's inset style. Use solid border style to get one color border line.

QGroupBox border

After searching for a while I saw that they way to set a visible border on a groupbox is to use the StyleSheet property. I added:
border: 2px solid gray;
but there are a couple of problems.
1) Everything inside the groupbox also inherits this setting!
2) The border has a little hole/piece missing near the title.
Here is a picture of what I'm talking about:
Anyone know how to do this properly?
Thanks,
David
The first problem is simple enough When you add a stylesheet to a control it automatically propagates the style to all child widgets. However, you can restrict the use of the style sheet in a couple of ways. You can specify the type of control you want the style sheet to apply to. Example:
QGroupBox {
border: 2px solid gray;
border-radius: 3px;
}
This style sheet will only be set on Group boxes. However, if you put a second group box inside this one, the style will propagate to this one as well. Which may be good or bad.
Another way is to specifically the objectName of the widget you are applying the style to. Example:
QGroupBox#MyGroupBox {
border: 2px solid gray;
border-radius: 3px;
}
This will only apply the style to a group box with an object name of MyGroupBox.
As for the space, it is happening because the title is being drawn on top of your border. You can also add a section to your style sheet to change your groupbox title. This includes setting it's background to transparent, and to move the title around to your hearts content.
Example: This will set your title to the top left corner of the group box just inside your border, with no gap.
QGroupBox::title {
background-color: transparent;
subcontrol-position: top left; /* position at the top left*/
padding:2 13px;
}
this worked for me on Qt 5.1.
qApp->setStyleSheet("QGroupBox { border: 1px solid gray;}");
Elimeléc
Specify a selector for the group box style such as:
QGroupBox
{
border: 2px solid gray;
}
As for the gap, you can probably fix that by setting some padding. Check the docs here.

Resources