I think this might (it's just a guess, I haven't checked it) also work:
class BSFontLoader
{
Q_OBJECT
Q_ENUMS(Status)
Q_PROPERTY(QVariant sources READ sources WRITE setSources
) // note -- QVariant, not QVariantList Q_CLASSINFO("DefaultProperty", "sources")
...
}
class BSFontLoader
: public QObject
{
Q_OBJECT
Q_ENUMS(Status)
Q_PROPERTY(QVariant sources READ sources WRITE setSources) // note -- QVariant, not QVariantList
Q_CLASSINFO("DefaultProperty", "sources")
...
}
To copy to clipboard, switch view to plain text mode
FontLoader {
id: fl;
[ "example.ttf", "bla.ttf" ]
}
FontLoader {
"example.ttf"
}
FontLoader {
id: fl;
[ "example.ttf", "bla.ttf" ]
}
FontLoader {
"example.ttf"
}
To copy to clipboard, switch view to plain text mode
setSources() would then need to use QVariant::isList() to check whether one or more values have been set to it. The bad part of all solutions here is that you can't do this:
fl.sources.push("xyz")
fl.sources.push("xyz")
To copy to clipboard, switch view to plain text mode
or similar (regardless if sources contains an array or not).
Bookmarks