Writing 2 plugins refering to the same bunch of code
Hello,
I'd like to write 2 plugins sharing 80% of their code (one as a standard dialog, one as right-panel explorer).
I couldn't find how to write a library of qml code, reusable in plugins. Is this possible ?
Cheers,
Comments
you can include any .js file in a .qml file
In reply to you can include any .js file… by Jojo-Schmitz
Thanks. What is the syntax for this ?
I used this documentation https://doc.qt.io/qt-5/qtqml-javascript-imports.html
With a really basic teslib.js file:
And it returns the following error:
Is this the right syntax ?
BTW, I used to have a link to the versions of the different QML components that were supported in MuseScore. Couldn't find a back. Can someone point me back to that page ?
In reply to Thanks. What is the syntax… by parkingb
I just applied your example and it works for me. // opens an empty dialog-window)
Presumably your plugin path might be wrong.
In reply to Thanks. What is the syntax… by parkingb
Rename it from teslib.js to testlib.js
In reply to Thanks. What is the syntax… by parkingb
Strangely it was working this morning. So no issue in the filename or path (although a typo error in my question above).
So I went further in my investigation. And actually, the issue is that it seems that MuseScore load the .js file into memory only once. I guess the first time it is needed. And so whatever are the modifications made to the .js file, MS doesn't take those into account (at least from the plugin editor).
One have to close MS and reopen MS to have it loafing the .js file again.
Any way to force MS to re-read the .js file from disk ?
In reply to Strangely it is working this… by parkingb
The plug-in manager has a reload button.
In reply to The plug-in manager has a… by Dylan Nicholson1
And from the plugin editor ?