Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QFrame's stylesheet affecting QLabel

I am using QFrame just to have colored border, since I couldn't find the a way to change color of the QDialog. So because of tampering with QFrame's border, it is also affecting the QLabel's look, is there any way to avoid this?

Edit: Here is the Stylesheet which I am using, where QLabels' doesn't have any effect. It's taking QFrames'

QWidget {
    background-color: black;
}
QLabel {
    color:white;
    border: solid 2px black;
    font: bold 19px Sans Serif;
}
QFrame {
    border: solid 2px white;
    border-radius: 4px;
}
like image 457
Xavier Geoffrey Avatar asked Oct 15 '25 18:10

Xavier Geoffrey


1 Answers

Instead of using a type selector which matches all the instances of that class and its subclasses, use a class selector.

So in your stylesheet, instead of using QFrame{...}, use .QFrame{border: 1px solid red;}. Note the . before the class name.

See more about selector types here.

like image 184
thuga Avatar answered Oct 17 '25 22:10

thuga



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!