For example:
if I want to create buttons, which, when pressed, each modify a single aspect of the stylesheet:
- One button can insert a
margin-leftattribute of 10. - Another button can make the background colors blue.
- Lastly, another button can round the corners.
The trick here, though, is that I don’t want to store all the variables and rebuild the style sheet on each button press. I would like, for example, to have a simple:
this->setStyleSheet(this->getStylesheet()+"margin-left: 10px:")
Here is the code in main.cpp:
Setting and getting the style sheet works with QString, and so, you can use
+operator.