-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exposing QQmlEngine::clearComponentCache
for live reloading
#195
Labels
Comments
The |
Thanks, I share your frustration and didn't know about this solution. Exposing |
barche
added a commit
to JuliaGraphics/jlqml
that referenced
this issue
Apr 27, 2024
barche
added a commit
to JuliaGraphics/jlqml
that referenced
this issue
Apr 30, 2024
barche
added a commit
that referenced
this issue
May 1, 2024
Issue Exposing `QQmlEngine::clearComponentCache` for live reloading #195
barche
added a commit
that referenced
this issue
Jun 18, 2024
Issue Exposing `QQmlEngine::clearComponentCache` for live reloading #195
Closed
Thanks for suggesting this, it is now sort of working, to be demoed tomorrow at JuliaCon ;) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While developing UI features in QML for my application, I got frustrated with the current workflow because it requires restarting the QML application to see changes. This is exacerbated by my window manager, who decides to place the created application randomly between different screens.
A solution to this would be implementing live reloading. I have been following the approach outlined in https://qml.guide/live-reloading-hot-reloading-qml. The technique primarily involves using Loader extensively to reload the components dynamically.
However, a major obstacle with this approach is related to how QML manages caching. QML caches loaded objects based on their filenames, meaning reloading the same file doesn’t reflect any changes made to it. To update the cache and see the changes, the component cache needs to be cleared first. Unfortunately, the necessary function QQmlEngine::clearComponentCache() is not currently exposed.
I also tried to make a workaround by adding a url parameter to the cache like:
which worked but did not reload components on which the circle itself depended; thus, it’s a dead end.
If
QQmlEngine::clearComponentCache
would be exposed by QML, I could implement a qmlfunctionJulia.clearCache()
, which would allow me to integrate live reloading in my workflow. Tracking QML source files and updating the view would be something I could also explore if theclearComponentCache
would be exposed.The text was updated successfully, but these errors were encountered: