Property variant limit?
Hi,
I have some code that will not run if I add any more than 4 property variant arrays of the dimension 4 x 3. I am wondering if there is a limit to the property variant elements or if there is some way to get around this issue?
My goal is to add 13 total arrays as property variants in the initial portion of the documentation.
Thank you!
Comments
I'm not aware of any such limit. Are you using declarations of the following form?
property variant foo: // etc
If so, try replacing "variant" with "var". (See http://doc.qt.io/qt-5/qml-variant.html : "The variant type is a generic property type. It is obsolete and exists only to support old applications; new applications should use var type properties instead.") Although I doubt this will resolve your issue.
If you provide more info or a snippet of your code we might be able to help more.
In reply to I'm not aware of any such… by PaulSC
Thank you so much for your willingness to help!
I changed the declarations to "var", which does seem like good practice. Thank you for that suggestion, however it does not resolve the issue, as you had already expected. Here is a code snippet, maybe I am missing something.
import QtQuick 2.0
import MuseScore 1.0
MuseScore {
version: "1.0"
description: "This demo plugin colors notes in the selection depending on pitch, matched to SolJAMM colors"
menuPath: "Plugins.Notes.SolJAMMKeycolors"
/*
property var colorsDSh : [
"#b400d0", "#000000", "#969696"
"#ff0000", "#000000", "#ffaa00",
"#000000", "#ffff00", "#00bb00",
"#000000", "#0000ff", "#000000",
]
// etc.. for 8 more arrays
*/
property var black : "#000000"
I call these variables using:
function colorKey(note){
// etc.. addressing all property variants
}
If I uncomment any more than 4 property variant arrays the code will not run.
Please let me know if you would like me to provide anything else.
Any thoughts?
Many thanks!
In reply to Thank you so much for your… by soljamm
colorsDSh in the above snippet is missing a comma after the 3rd element. If you add that (and check the rest of your code for similar omissions) does it work?
If not, what error message is QML giving you?
In reply to colorsDSh in the above… by PaulSC
Yes! It is now working, thank you so much!
I love it when that happens. I really appreciate you taking a second look.
Out of curiosity, what QML editor are you using to debug your code? I haven't seen any error messages in the Plugin creator provided by MuseScore.
In reply to Yes! It is now working,… by soljamm
I'm glad your plugin is running!
I use MuseScore's built-in editor. It should give you a console view below the text-editor. See the attached screenshot. If your view is different, try dragging the bar below the editor to resize the editor and console frames. (Or maybe this feature is platform-dependent? I'm on Windows 8.1 fwiw.)
In reply to I'm glad your plugin is… by PaulSC
Interesting.... I've never seen that console view before. I run Windows 10, but if you can see it, I'm sure there is a way I can too. Thanks for your help!