We assume that you know the Qt API that allows users to customize their interface components (widgets) through a simple scripting language called Qt Style Sheets. which is based on the CSS syntax for HTML. If you do not know, we recommend that you start to get interested in this API by going to the official website of Qt.
You will have a file of the type .rar, an archive which bears the name of the chosen template (StyleEaxmple.rar). This archive contains:
-Style Example.qss : the file that contains the syntax of Qt Style Sheets customize and adaptable to all chosen graphic components.
-License.txt : contains the text of the license which authorizes the use of the file in the respect of the copyrights for the moment it is the license MIT.
-template.png : a preview on the result of the style sheets on the interface.
The qss file is compatible with all Qt applications (Qt4, Qt5, Py Side, Py Side2, Qt4 Py, Qt5 Py, Qt Py, PyQtGraph).
External reading from file :
Load from resources (.qrc & .pro) :
Change the path to the URL qrc, always started by ":/".
To understand how the resource system works, please consult this link The Qt Resource System.
Here is an example using PySide :
PyQt4 :
PyQt5, more lines need to be changed because of its API :
If your project uses QtPy :
It is also simple with PyQtGraph :
DO YOU LIKE ? SHARE THIS !