Ableton / aqt-stylesheets

Apply CSS style sheets to QML applications
Other
214 stars 39 forks source link

Problems when the qml files are located in a .qrc file #53

Open Zicandar opened 7 years ago

Zicandar commented 7 years ago

If the .qml file(s) are located in a qt resource file, then it seems that any relative path set in the qml will be automatically translated into a relative path inside the qrc. However the code is checking that the file is a local file, before attempting to load it, and because it is inside a qrc file, it will ignore it. I was not getting any error message in the output from this, and while I have hacked a solution that solves it locally for us: (same thing done for the default stylesheet source). void StyleEngineSetup::setStyleSheetSource(const QUrl& url) { QUrl modifiedUrl = url.adjusted(QUrl::RemoveScheme); modifiedUrl = modifiedUrl.fileName(); modifiedUrl.setScheme("file"); The modifiedUrl is then used in place of "url" in the functions. However this hack itself has some obvious issues, such as only keeping the filename, and no path. (Note that our qml files were in a subdirectory "inside" the qml file, making it trickier. For us this should work fine, so there is no hurry from us to solve it.

Cheers, Zicandar p.s. This plugin is amazing so far! Good work and thanks for sharing it!