CSS set fonts, colors, etc.
- Two ways
- On the ui design page, find the attribute of the styleSheet of the control, open the input box, and enter the fixed format instruction settings:
- Use API interface settings, setStyleSheet interface.
The format of QString input in Method 1 and Method 2 is the same:
- "
Background : rgb(0,255,0);" Set the background to green. - "Color: rgb(255,0,0);"
sets the color of text to red.
Note that there is a ";" after each line
The way to use the code directly is:
setStyleSheet("background: rgb(0,255,0)");
setStyleSheet("color: red");