diff options
author | Sandro S. Andrade <sandroandrade@kde.org> | 2013-10-07 09:36:50 -0300 |
---|---|---|
committer | Sandro S. Andrade <sandroandrade@kde.org> | 2013-10-07 14:34:31 +0200 |
commit | 5e4a780b40543fa12d6d9607e3193fb111c5ab84 (patch) | |
tree | eb747784d9f3319d6ac7954eea269614aaad9277 /scripts/templates | |
parent | 3031fe1254052bdeffec90ca76e2f3649a971ae7 (diff) |
Improve property metadata information
Change-Id: Ia9a7db26b2e7b8696aa7b82aed93c0fa6ebad8ce
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'scripts/templates')
-rw-r--r-- | scripts/templates/common.tmpl | 2 | ||||
-rw-r--r-- | scripts/templates/qclass.cpp | 18 |
2 files changed, 10 insertions, 10 deletions
diff --git a/scripts/templates/common.tmpl b/scripts/templates/common.tmpl index fc94026b..ba4d8e63 100644 --- a/scripts/templates/common.tmpl +++ b/scripts/templates/common.tmpl @@ -110,7 +110,7 @@ ${attributeName} [%- SET qtAttribute = QT_ATTRIBUTE(attribute) -%] [%- NEXT IF redefinedProperties.grep("^${className}-${qtAttribute}$").size > 0 -%] [%- SET qtType = QT_TYPE(namespace, attribute, "false") %] - Q_PROPERTY(${qtType.trim} ${qtAttribute} READ ${PLURALFORM(qtAttribute, attribute)}[% IF attribute.findvalue("defaultValue/@xmi:type") != "" %] RESET unset${qtAttribute.remove("^is").ucfirst}[% END %][% IF attribute.findvalue("@isDerived") == "true" and attribute.findvalue("@isDerivedUnion") != "true" %] STORED false[% END %]) + Q_PROPERTY(${qtType.trim} ${qtAttribute} READ ${PLURALFORM(qtAttribute, attribute)}[% IF attribute.findvalue("@isReadOnly") != "true" and !(attribute.findnodes("upperValue").findvalue("@value") == "*")%] WRITE set${qtAttribute.remove("^is").ucfirst.remove('_$')}[% END %][% IF attribute.findvalue("defaultValue/@xmi:type") != "" %] RESET unset${qtAttribute.remove("^is").ucfirst}[% END %][% IF attribute.findvalue("@isDerived") == "true" and attribute.findvalue("@isDerivedUnion") != "true" %] STORED false[% END %]) [%- END %] [%- END -%] [%- MACRO GENERATE_ATTRIBUTES(class, visitedClasses, redefinedProperties) BLOCK -%] diff --git a/scripts/templates/qclass.cpp b/scripts/templates/qclass.cpp index 0f33637b..dbbf63b5 100644 --- a/scripts/templates/qclass.cpp +++ b/scripts/templates/qclass.cpp @@ -408,17 +408,17 @@ void Q${namespace}${className}::setPropertyData() [%- FOREACH attribute = class.findnodes("ownedAttribute") -%] [%- SET association = attribute.findvalue("@association") -%] [%- IF attribute.findvalue("@aggregation") == "composite" %] - QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::AggregationRole] = QStringLiteral("composite"); + QModelingObject::propertyDataHash[QStringLiteral("Q${namespace}${className}")][QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::AggregationRole] = QStringLiteral("composite"); [%- ELSE %] - QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::AggregationRole] = QStringLiteral("none"); + QModelingObject::propertyDataHash[QStringLiteral("Q${namespace}${className}")][QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::AggregationRole] = QStringLiteral("none"); [%- END %] - QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::PropertyClassRole] = QStringLiteral("Q${namespace}${className}"); - QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::IsDerivedRole] = [% IF attribute.findvalue("@isDerived") == "true" %]true[% ELSE %]false[% END %]; - QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::IsDerivedUnionRole] = [% IF attribute.findvalue("@isDerivedUnion") == "true" %]true[% ELSE %]false[% END %]; - QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::DocumentationRole] = QStringLiteral("${attribute.findvalue("ownedComment/body/text()")}"); - QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::RedefinedPropertiesRole] = QStringLiteral("${attribute.findvalue("@redefinedProperty")}"); - QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::SubsettedPropertiesRole] = QStringLiteral("${attribute.findvalue("@subsettedProperty")}"); - QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::OppositeEndRole] = QStringLiteral(" + QModelingObject::propertyDataHash[QStringLiteral("Q${namespace}${className}")][QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::PropertyClassRole] = QStringLiteral("Q${namespace}${className}"); + QModelingObject::propertyDataHash[QStringLiteral("Q${namespace}${className}")][QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::IsDerivedRole] = [% IF attribute.findvalue("@isDerived") == "true" %]true[% ELSE %]false[% END %]; + QModelingObject::propertyDataHash[QStringLiteral("Q${namespace}${className}")][QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::IsDerivedUnionRole] = [% IF attribute.findvalue("@isDerivedUnion") == "true" %]true[% ELSE %]false[% END %]; + QModelingObject::propertyDataHash[QStringLiteral("Q${namespace}${className}")][QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::DocumentationRole] = QStringLiteral("${attribute.findvalue("ownedComment/body/text()")}"); + QModelingObject::propertyDataHash[QStringLiteral("Q${namespace}${className}")][QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::RedefinedPropertiesRole] = QStringLiteral("${attribute.findvalue("@redefinedProperty")}"); + QModelingObject::propertyDataHash[QStringLiteral("Q${namespace}${className}")][QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::SubsettedPropertiesRole] = QStringLiteral("${attribute.findvalue("@subsettedProperty")}"); + QModelingObject::propertyDataHash[QStringLiteral("Q${namespace}${className}")][QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::OppositeEndRole] = QStringLiteral(" [%- IF association != "" -%] [%- FOREACH memberEnd = xmi.findvalue("//packagedElement[@xmi:type=\"uml:Association\" and @name=\"${association}\"]/@memberEnd").split(' ') -%] [%- NEXT IF memberEnd == className.replace('$', "-${attribute.findvalue(\"@name\")}") -%] |