void FormGenRecordComposition::setVaidatedValueImpl(const QVariant &val)
{
    mUpdating = UpdatingState;

    const QVariantHash map = val.toHash();
    for( auto it = map.cbegin(); it != map.cend(); ++it )
        mElements.at(mTagIndexMap.value(it.key())).element->setValidatedValue(it.value());

    if( mUpdating == UpdatingWithChangeState )
        emit valueChanged();

    mUpdating = NotUpdatingState;
}
FormGenAcceptResult FormGenChoiceComposition::acceptsValueImpl(const QVariant &val) const
{
    if( variantType(val) != QMetaType::QVariantHash )
        return FormGenAcceptResult::reject({}, val);

    QVariantHash hash = val.toHash();
    if( hash.size() != 1 )
        return FormGenAcceptResult::reject({}, hash);

    auto it = mTagIndexMap.find(hash.cbegin().key());
    if( it == mTagIndexMap.cend() )
        return FormGenAcceptResult::reject({}, hash);

    auto elementAccepts = mElements.at(it.value()).element->acceptsValue(hash.cbegin().value());
    if( ! elementAccepts.acceptable ) {
        QString path = it.key();
        if( ! elementAccepts.path.isEmpty() )
            path += QString("/%1").arg(elementAccepts.path);
        return FormGenAcceptResult::reject(path, elementAccepts.value);
    }

    QString keyValue = FormGenElement::keyStringValuePair(it.key(), elementAccepts.valueString);
    return FormGenAcceptResult::accept(val, FormGenElement::objectString(QStringList({keyValue})));
}