Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
User defined StyleSheet and fallback StyleSheet
aheimberger last edited by aheimberger
I am making a Qt Quick application which has a predefined style-sheet which is built into the application, but can also support user defined style-sheets.
I am currently working on one problem: If I changes entries in my default style-sheet I also have to put them into the user defined style-sheet. If i forget to do this, it could break the layout of the application. In this case it should take the predefined style-sheet which is build into the application, but only the missing property.
So what I do basically is.
At the startup of the application I check the users directory if the user has uploaded a stylesheet.
If a stylesheet exists i load it via
qmlRegisterSingletonType("file:/....../Style.qml", "Style", 1, 0, "MenuStyle");
but if there is no style I register
qmlRegisterSingletonType("qrc:/...../Style.qml", "Style", 1, 0, "MenuStyle");
Thats actually the starting point of the problem. Now I have either the default style or the user style, but not both.
In my qml Files for a specific dialog I can use MenuStyle to access the style properties, but when its not defined in the user stylesheet it should take the default style-sheet which is build into the application.
Do you have any idea how I can make this, and only access MenuStyle?