Default values for properties when creating object

  • Is it possible to define in the dashboard some default value for an object property.
    Such as it would be filled when creating the object if the property value is not specified at creation.

    From now when you create an object whitout initializing all properties, the properties aren't created. Then when loading such object in a model, those properties are missing, generating undefined value and hence are impossible to modify.

  • Hi,
    You can add a validator to the property, which would refuse to add a wrong property value. If you use C++ then you can overload EnginioModel::roleNames and EnginioModel::setData to force usage of an undetected custom role. We are working on simplifing this use case.

  • I'd like to go the way of the validator to the property, is it only possible to refuse to add an incomplete object, or is possible to add it and set default value for missing properties ?
    Is there any doc to the validator syntax ?


  • I asked a few people and it seems that currently there is no support for default value nad there is high chance that it will not be implemented in a short term.

    The docs are missing, but I believe that it will be fixed soon.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.