l3whmg wrote:Ricci wrote:
No, not the whole stylesheet is lost with setStyleSheet(). It works as in XHTML, you only change these parts of the whole (unknown) stylesheet that you like.
Are you sure?
I think I found out how it works: not identical to XHTML.
Every Qt-application has an application-wide style sheet (that can be changed).
If you overwrite something (i.e. a Label) with oMainform:oLabel:QtObject:setStyleSheet( "background-color: red; color: yellow;" ) than the text will be yellow on red background.
If you do a second oMainform:oLabel:QtObject:setStyleSheet( "background-color: green;" ) on this label than first all user defined definitions are deleted (back to application-wide style sheet) and than the new stylesheet command will be executed. At the end you get black text on green background.
So you need to save your old definition before applying the new one:
oMainform:oLabel:QtObject:setStyleSheet( "background-color: red; color: yellow;" )
oMainform:oLabel:QtObject:setStyleSheet( oMainform:oLabel:QtObject:StyleSheet( ) + "background-color: green;" )
This will give you a yellow text on green background.
You have two times a background-color in you style-sheet command (first red, second green) but as the CSS rules say: the last one wins.