control the border of the frame and its components - qt

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.

Related

How would you write an Sheet which does only make a Solid Line on top of the Template-cell and the left side?

I have a Template constructed out of many Cells as part of a Form. I wrote several Types which have borders background colours and so on, so that i , in the end, could apply them to the cells at the edges and construct a box around the whole Information by putting them together. To make it clear here an example of what i try to do:
if you had 9 cells in form a cupe the middle top one would just have a border on the top the top left one would have borders on the left and the top and so on. That works well for the "straight" parts, in this example the middle parts of every side.
But the corners just don't appear neither the background color or the borders.
What i tried is basically that . I wrote the following code for the bottom right corner:
.brechtsunten {
background-color: #81a0e9 !important;
border-right: 2px solid !important;
border-bottom: 2px solid !important;
border-color: #183b8b !important;
}
And it does nothing , and by nothing i mean it doesn't even appear in the style filter of the inspector section if i open the form extern in my browser, so i get nothing i could work with like a syntax error message.
You have to specify the border property if you use border-bottom
Example
border-bottom-width: 33px;
The correct way to write your CSS
background-color: #81a0e9 !important;
border-right-width: 2px;
border-bottom-width: 2px;
border: 0px solid #183b8b;
}

Not sure what's overriding "focus" for form fields

This seems to have the solution I need...
Border radius on Focus input field
Where I want the focus border to match the border radius used for the box itself. As it is right now, the box has curved corners but the focus does not so it looks odd.
I tried...
*:focus {
outline: none;
box-shadow: 0px 0px 2px blue;
}
and...
.field-box:focus {
outline: none;
box-shadow: 0px 0px 2px blue;
}
but neither work so I'm thinking something at a parent level is overriding it. When I check for the css in inspect, I don't see it show up so I can't confirm that is the case. I just know that I can make other changes to the form box but not the focus border itself. Anyone know how to address or if there is a way to identify what might be overriding it?

SAPUI5 - Input border/frame

I want to get rid of the frame that is around an Input in SAPUI5 framework. I want to make an input field elevated but the frame around the input field makes it not like desired.
I have tried it using CSS like this:
.cityInput{
border-bottom-color: #FFFFFF;
color: #FFFFFF;
background: none;
min-height: 27px;
border: none;
outline: none;
box-shadow: 5px 5px 7px #808888;
}
I want to get rid of the two yellow lines that surrounds the input field.
Thanks.
I am assuming that you want to get rid of the default (silver/grey) border around the input box. If this is the case then I would suggest making the border color same as your background. Making border=none, on the input class, directly does not work.
.cityInput .sapMInputBaseInner {
border: 1px solid #fdf6b1;
}

CSS property - set global border first, and then specify border-bottom?

What is the best CSS practice to achieve a border on all sides of a container, apart from, for example, the bottom?
The border property cannot specify different values for each side.
Option 1: Overwriting Rules
border: 1px solid red;
border-bottom: none;
Seems that an extra computation is needed — similar drawbacks as CSS resets (at least philosophically).
Option 2: Setting Specific Rules
border-top: 1px solid red;
border-left: 1px solid red;
border-right: 1px solid red;
Might be more correct (in terms of CSS "semantics")
But if you want to change the border specifics, then it'll require
multiple changes (harder to manage).
Actually it totally depends on you, what is more convenient to you, it also depends on some state like if I want the color of all borders to be same I'll go for 1st but If I think I need to change the colors of each side of the border in near future I'll go with the second 1, but for now, I'll stick to first option
Reasons:
Less CSS to be stated
Specifically it shows that I want border-bottom as none
As you said I don't need to change each and every property: value if I need any changes
If you say proper semantics, proper semantics define very specifically like
border-color: /*Whatever*/;
border-width: /*Whatever*/;
border-style: /*Whatever*/;
Now am sure you don't want to be this specific
If you only want to specify the values once, you can specify the color and width for all, then the style specifically for the sides:
border-color: red;
border-width: 1px;
border-style: solid solid none solid;

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