best way to create diffrent theme in program
-
Hey guys, some question
imagine we a gui that we created mostly in QtDesigner; the gui use lots of stylesheet for the element inside of it that mostly changed the look of elements (most of stylesheet add inside the designer itself)
what is best way to create a dark and light mode for the gui? I mean how can we change the color of all element in gui in each mode that work best?
I'm talking about just changing the color, not each time add the whole stylesheet to it with different color? -
Hi,
If you want to change an element of a stylesheet you have to re-apply the stylesheet afterward.
So if you have "changeable" style sheets, the most simple is to keep them in strings with arguments so that you can regenerate them at will.
-
Hi,
If you want to change an element of a stylesheet you have to re-apply the stylesheet afterward.
So if you have "changeable" style sheets, the most simple is to keep them in strings with arguments so that you can regenerate them at will.
@SGaist so I cant just apply it in designer and just later change the color of it?
other then that what is the best way to apply the stylesheet to whole widgets? should I just create a long stylesheet and apply all styles to all element inside it and put it to a top widget? -
@SGaist so I cant just apply it in designer and just later change the color of it?
other then that what is the best way to apply the stylesheet to whole widgets? should I just create a long stylesheet and apply all styles to all element inside it and put it to a top widget?@saeid0034 said in best way to create diffrent theme in program:
@SGaist so I cant just apply it in designer and just later change the color of it?
You would need to retrieve that stylesheet, parse it,
do the modification and then re-apply it.other then that what is the best way to apply the stylesheet to whole widgets? should I just create a long stylesheet and apply all styles to all element inside it and put it to a top widget?
That depends on what you want to change and the structure of your widgets.
-
@saeid0034 said in best way to create diffrent theme in program:
@SGaist so I cant just apply it in designer and just later change the color of it?
You would need to retrieve that stylesheet, parse it,
do the modification and then re-apply it.other then that what is the best way to apply the stylesheet to whole widgets? should I just create a long stylesheet and apply all styles to all element inside it and put it to a top widget?
That depends on what you want to change and the structure of your widgets.
-
@SGaist can I do somthing like put formating argument in Stylesheet in QDesigner then latter change it using the format?
@saeid0034
Indeed, but this is down to you 100% to write the code to read & replace, there is nothing in QSS/CSS that will do that. -
@saeid0034
Indeed, but this is down to you 100% to write the code to read & replace, there is nothing in QSS/CSS that will do that.