Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
What if setStylesheet fails?
kumararajas last edited by
Assuming that, I am using qss file in my application.
.qss file contains all the styles required for the application.
And I use global pointer to set the stylesheet.
My question is,
What if I made a mistake in blah.qss. Or say if the file is corrupted?
setStyleSheet is a void function, it does not return any error.
Is there any way to catch the failure?
Well, during development, it will show error in "Application Output" but so far I did not find a good solution to check when deployed.
It might be a good idea in final release to embed the file in qrc so it cannot be corrupted if that is an option.
Alternative, you could have a hidden object
and in the end of the stylesheet, alter some values for that widget
that you can also access from code. That way you can check if it was applied.