This question already has answers here:
QRadioButton color change on Selected and deselected Qt
(3 answers)
Closed 2 years ago.
I'm trying to change the dot's color of the radiobutton using the following code:
ui->radioButton->setStyleSheet("QRadioButton{ color: red;}");
in Linux it's working like a charm but on windows it's just changing the label color of the radiobutton
Can anyone help me please?
For changing dot's color of QRadioButton use QRadioButton::indicator :
ui->radioButton->setStyleSheet("QRadioButton{ color: red;} QRadioButton::indicator{color : blue;}");
most complete example from qt docs:
QRadioButton::indicator {
width: 13px;
height: 13px;
}
QRadioButton::indicator::unchecked {
image: url(:/images/radiobutton_unchecked.png);
}
QRadioButton::indicator:unchecked:hover {
image: url(:/images/radiobutton_unchecked_hover.png);
}
QRadioButton::indicator:unchecked:pressed {
image: url(:/images/radiobutton_unchecked_pressed.png);
}
QRadioButton::indicator::checked {
image: url(:/images/radiobutton_checked.png);
}
QRadioButton::indicator:checked:hover {
image: url(:/images/radiobutton_checked_hover.png);
}
QRadioButton::indicator:checked:pressed {
image: url(:/images/radiobutton_checked_pressed.png);
}
Related
This question already has answers here:
How wide is the default `<body>` margin?
(4 answers)
Closed 1 year ago.
I started studying CSS and I'm using an online IDE called replit to do some tests.
Today I've tried to create a simple rectangle shape and I realized that it couldn't reach the page borders, so I'm here to ask how to make this rectangle to reach it (https://2.thiagoalonso05.repl.co).
I created an empty div and put its class as greybar, after that, I went to CSS. Here's my code:
body {
background-color: #181818;
}
.greybar {
display: block;
height: 48px;
background-color: #202020;
}
Here's an image showing where I want the grey bar to reach (the red part):
Just remove the default margin and padding.
* {
margin:0;
padding:0;
}
body {
background-color: #181818;
}
.greybar {
display: block;
height: 48px;
background-color: #202020;
}
<div class="greybar"></div>
This question already has answers here:
Lighten parent's (unknown) background-color in child
(3 answers)
How to override a LESS mixin variable based on a parent's variable
(1 answer)
Closed 7 years ago.
Hi I'm new to using Less and trying to make the best of the features it offers. What I would like to do is the following:
say I have a few anchor elements in html
Blue link
Red link
Green link
and I have the following css
.gen-link-prop {
text-decoration: none;
padding: 10px 40px;
color: #fff;
display: inline-block;
margin: 0 5px;
}
#blue-link-color: #9999ff;
#red-link-color: #ff9999;
#green-link-color: #99ff99;
.blue-link {
.gen-link-prop;
background-color: #blue-link-color;
}
.red-link {
.gen-link-prop;
background-color: #red-link-color;
}
.green-link {
.gen-link-prop;
background-color: #green-link-color;
}
.blue-link:hover, .red-link:hover, .green-link:hover {
background-color: darken(#<-- reference to base color here--<, 20%);
}
I want to be able to apply an operation to a property value that is already applied to the element. Is this even possible? Or is it something simple that I missed somewhere. Help is greatly appreciated
This question already has answers here:
Sass - Manipulate inherited property?
(4 answers)
Closed 7 years ago.
Or maybe there's preprocessor solution.
Suppose you have 20 buttons. Each with a different color.
The colors are set like this:
button {
background: red;
}
So you can write something like this
button:hover {
this.background: darken(10%);
}
And this will darken each button's background color.
Instead of writing color codes for each button which is red, blue, green, etc... And this can be applied also to more CSS properties.
Without JS of course.
Do they plan to introduce it? Is there a solutin via SASS/LESS/Stylus ?
There is nothing like that in Sass, but you can use a mixin like this code:
#mixin addColor($color) {
background: $color;
&:hover {
background: darken($color, 10%);
}
}
.foo {
#include addColor(red);
}
.anotherFoo {
#include addColor(blue);
}
This question already has an answer here:
Concatenating nested classes using SASS [duplicate]
(1 answer)
Closed 8 years ago.
I have the following:
div {
.demo {
color: #000;
}
}
Which Outputs:
div .demo { color: #000; }
However, I need it to output without the space between the element and the class:
div.demo { color: #000; }
Is there any way to do this using SASS Nesting?
Use & to combine a selector with its parent:
div {
&.demo {
color: #000;
}
}
You can use the ampersand in front of .demo to achieve this.
div {
&.demo {
color: #000;
}
}
The ampersand character is a placeholder for whatever the parent element is.
This question already has answers here:
Sass - Manipulate inherited property?
(4 answers)
Closed 8 years ago.
I want to set up some sass color rules that will automatically choose the font color variable for me. I want the text color to be dependent on what color the background color of the parent div is.
If
div {background-color: #000; }
Then
div p { color: #fff; }
How can this be achieved with sass?
You could use lightness() function for the background-color to determine the color value, as follows:
#function set-color($color) {
#if (lightness($color) > 40) {
#return #000;
}
#else {
#return #FFF;
}
}
Then use the above function as below:
div { background-color: black; // Or whatever else }
div p { color: set-color(black); }
LIVE DEMO.
You could use control directives.
It depends on the purpose, but there might be easier ways to change a background color depending on a certain condition, such as Javascript.