Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to set qss property back to its default value?
I'm stying the QProgressBar using qss:
this piece of code is just similar to the "qt styesheet sample page":http://doc.qt.nokia.com/4.6/stylesheet-examples.html#customizing-qprogressbar
and then I have a special QProgressBar to overwrite this style define, actually, I don't need the grid effect this time, so I set the margin to 0, and when I tried to set the width back to its default value, I got stuck.
the code is something like this:
I searched around and tried the values auto/none/0/initial/default/whatever and had no lucky here, it just wont give me the right effect, when the width is not specified.
Anyone have any suggestions on this?
Uhhh, I just found a value, -1, which will set it back to default, at least for the width property in this particular situation...
Guest last edited by
ok not sure if I understood your question fully ...
You have set a qss to your app and then you have overridden it in your progress bar and now to reset the style of the progress bar to the default, you just need to do this ...
it will revert to the default style
Thanks for your reply
This is what I actually mean, just to be clear:
I get a qss file for styling the whole interface, in which I have many process bars.
But there is one of them, that I need to style in a different way, and want to do that in the same qss file.
ad5xj last edited by
Be sure to check the custom stylesheets section of the docs. I notice some stylesheet settings require you to use all attributes for the object when specifying custom stylesheet attributes.