How to use QT Creator for plugin development
I am after assistance with using Qt Creator for plugin development.
I have two initial questions:
1) Opening an existing qml plugin file in Qt Creator I am immediately faced with the fact that Qt Creator throws an 'Unknown component' error with the 'import MuseScore 3.0 statement'. How do I fix this?
2) How do you run a plugin from Qt Creator against/in Musescore?
Comments
1) You don't
2) You don't
Not currently and not with the 3.x sources.
There might be a sliver of hope if you are building against the full sources, but I believe the metadata for Qt Creator to grasp the MuseScore3.0 module in its QML editor is non-existent.
In reply to 1) You don't 2) You don't… by jeetee
The basis for my asking the question about using QT Creator is issue 269612 (https://musescore.org/en/node/269612), which asks the same question, and on the 24 May 2021 jojo-Schmitz added the comment: "You can use QtCreator
Probably even to a state that allows to close this issue".
But he did not supply sufficient information for me to understand how to do it.
In reply to The basis for my asking the… by barryw12
Better #269612: Plugin development with Qt Creator
You can use QtCreator to edit qml files, including syntax highlighting.
And as far as I can tell also without it complainins about not finding the MuseScore module. If you're setup to build the whole MuseScore with QtCreator too, that is.
In reply to Better #269612: Plugin… by Jojo-Schmitz
> "And as far as I can tell also without it complainins about not finding the MuseScore module. If you're setup to build the whole MuseScore with QtCreator too, that is."
It wasn't last time I tried (but that's also been over 2y ago, so perhaps there is some secret sauce by now?)
In reply to > "And as far as I can tell… by jeetee
I'd need to check again, but that won't happen within the next 3 weeks, as I'm some 800 km away from my computer.
In reply to Better #269612: Plugin… by Jojo-Schmitz
I have had a quick look at using Qt Creator as an editor for plugins and it seems to work Ok (that is an understatement it is - much better than Plugin Creator - but that wouldn't be hard to achieve).
I am not set up for whole of MuseScore build. And I am not sure what extra advantage I would get if I were.
From what I have observed, Qt Creator throws an error on the "import MuseScore ... " statement at the start of the plugin file and then ignores (does not highlight or throw errors to) references to MuseScore objects.
The advantages of the qml syntax highlighting, error and warning highlighting, decent indentation and collapsing of code block, find and replace, highlighting of lines of code that have been edited, predictive text etc etc make QT Creator the logical way to go. Despite having to also open the plugin file in the Musescore Plugin Creator to run it.
If you have the same plugin file open in QT Creator (for editing) and Plugin Creator (for running the code), QT Creator will provide notification to the user that the file has been modified outside and saved outside of QT Creator - for instance modified in, and saved from, Plugin Creator. Plugin Creator does not have an equivalent feature. But if it did (so that it would notify of changes to a plugin file made in QT Creator), it would greatly enhance the user friendliness of using Qt Creator as an Editor and Plugin Creator for running the code.
For the future of MuseScore plugin development:
1) I assume that to develop the Plugin Creator to the level that It was a decent IDE would require a lot of work
2) I would also assume that using an existing IDE such as plugin creator would be a lot less work than enhancing Plugin Creator.
3) As an interim measure adding the functionality to Plugin Creator to enable it to notify the user of external changes in the saved version of the open file would be an easy modification that would greatly enhance the usability of using QT Creator and Plugin Creator together - a 'cheap' way to get a lot of the advantage of fully using an IDE such as Qt Creator for plugin development.
Do you make request for feature enhancements by creating an 'issue'. Or is there a separate place to make feature requests?
In reply to I have had a quick look at… by barryw12
The benefit of setting QtCreator up for a full MuseScore build is that then is does not give that error for plugins.
Ar least if I remember correctly...
In reply to The benefit of setting… by Jojo-Schmitz
Does setting up QtCreator for a full MuseScore build simply get rid of the import error, or does it also let QtCreator know about (for syntax highlighting etc) all the MuseScore Plugin API objects and their properties/methods?