Using MuseScore icons set in a plugin UI
I'd like to use icons from MuseScore in to my plugins UI.
In my previous plugins I just did copy/paste as PNG and used those PNG. A bit tedious.
Is there any way to use those icon sets in a plugin UI ?
I searched for the Leland font on my MuseScore installation. Couldn't find it.
I searched for .SVG files. Couldn't find any.
I also tried this:
if (Qt.fontFamilies().indexOf('Leland') < 0) {
console.log("Leland not found");
}
And I couldn't find the font either.
Comments
Leland isn't a set of icons, it's a font, so not sure how that would help. But for the record, you can find all fonts and icons used in MsueScore on GitHub along with the full source code.
In reply to Leland isn't a set of icons,… by Marc Sabatella
A font should be alright if pre-installed by MuseScore, but I guess MuseScore bundles it inside its main code.
There is a FontLoader object in QML. But available from Qt.Quick2.15. In MS 3.6 we are limited to QtQuick2.9. Do you know Qt support in MS4 ?
In reply to A font should be alright if… by parkingb
MuseScore 4 will use at least Qt 5.15.2, not sure which Qt.Quick version that means
In reply to MuseScore 4 will use at… by Jojo-Schmitz
That's a good news !!
In reply to Leland isn't a set of icons,… by Marc Sabatella
hello, could you tell me exactly where I can find the icons used in the palettes? (such as clefs, time signatures, articulations, etc)
In reply to hello, could you tell me… by rob.dnz
The easiest way i'm using is like this:
In any QML component (ComboBox, TextField, ...) set the font to "MScore Text" and set the text to what ever symbol you'd like to display.
font.family: 'MScore Text'
font.pointSize: 10
text: "\uE4E5" // write a "rest" symbol
The only difficulty is to identify the right unicode character code.
For that you'll have to use a Font Manager software.
I'm using Corel Font Manager, but it is a paying one. Look on internet. There are some free ones.
In reply to The easiest way i'm using is… by parkingb
Bravura Text should work to, also Leland Text or any of the other Musical Text fonts. And also
<sym>restQuarter</sym>
or whatever the symbols palette of the master palette givesIn reply to Bravura Text should work to,… by Jojo-Schmitz
The
...
is working nice for texts in Musescore itself, but does it for QML components too ? In my short test, it just wrote "restQuarter" in plain text.In reply to The ... is working nice for… by parkingb
Not sure. Maybe need to 'escape' the
<sym>...</sym>
In reply to Not sure. Maybe need to … by Jojo-Schmitz
The sym substitution happens on MS text element handling, won't work in a plugin UI / generic QML label; there you need the unicode codepoints
I haven't tested this but I think it should be possible to use something like
":/data/icons/note-longa.svg"
where icon names can be found in this list. In Qt paths prefixed by
:
mean resources bundled into the executable, and:/data/icons
is the default MuseScore's path to search for icons.In reply to I haven't tested this but I… by dmitrio95
Unfortunately. Doesn't work.
Gives me a "QML Image: Cannot open: file:///D:/data/MuseScore3/Plugins/:/data/icons/note-longa.svg"
In reply to Unfortunately. Doesn't work… by parkingb
Ah, then it might be better to use
qrc:///data/icons/note-longa.svg
. I have just checked this and this option works for me.In reply to Do you use QML's Image? If… by dmitrio95
Working fine. Thanks. The list of the icons is now bookmarked.
We should definitely compile all these tricks in some doc.
Since most of your buttons are note durations you might be able to use the MScore font instead of images, like I did in the dropdown for TempoChanges.
See https://github.com/jeetee/MuseScore_TempoChanges/blob/master/TempoChang…
In reply to Since most of your buttons… by jeetee
Great. This is what I was looking for.
Actually that's where I started, but stopped when the test whether that font (and the Leland one) was installed answered we "not installed" :-(
if (Qt.fontFamilies().indexOf('Leland') <= 0) { console.log("NOT INSTALLED"); }
While actually QML is knowing them, without them actually be "installed" !!
For anyone looking to use this, the right Unicode characters to use can be found by analyzing the font which is located on the MuseScore font folder on GitHub