You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, blocks inherit from BlockDefinition. They must provide two components, editor and miniature, that both must provide a params property and a getParams() method. In addition, they must feel the defaultParams property.
This poses several problems:
If a block uses a complex object for storing its parameters, such as MusicScore, it is hard to avoid binding to a single instance of this object, leading to a shared object for all instances of the block.
Typically, the params properties of both editor and miniature are manually set to defaultParams, which is confusing. And, as a property is set, it prevents the instantiation of an object pragmatically, which would be necessary to avoid the shared object explained in point 1.
We should improve that. The least is to document the interface, in particular when params should be assigned and by whom. Also, maybe having a method of BlockDefinition that returns default parameters would be better than having a property, to allow for dynamically-created objects.
The text was updated successfully, but these errors were encountered:
Based on my recent experiments, it seems that the cleanest way to implement the current interface is to create a QML file with the actual editor, having a params property and a getParams() method, and in the block QML file, embed these editors in components, and set the params property to defaultParams, itself set to a JSON object describing default parameters.
Currently, blocks inherit from
BlockDefinition
. They must provide two components,editor
andminiature
, that both must provide aparams
property and agetParams()
method. In addition, they must feel thedefaultParams
property.This poses several problems:
MusicScore
, it is hard to avoid binding to a single instance of this object, leading to a shared object for all instances of the block.params
properties of botheditor
andminiature
are manually set todefaultParams
, which is confusing. And, as a property is set, it prevents the instantiation of an object pragmatically, which would be necessary to avoid the shared object explained in point 1.We should improve that. The least is to document the interface, in particular when
params
should be assigned and by whom. Also, maybe having a method ofBlockDefinition
that returns default parameters would be better than having a property, to allow for dynamically-created objects.The text was updated successfully, but these errors were encountered: