summaryrefslogtreecommitdiffstats
path: root/scripts/templates
diff options
context:
space:
mode:
authorSandro S. Andrade <sandroandrade@kde.org>2013-11-02 18:17:31 -0300
committerSandro S. Andrade <sandroandrade@kde.org>2013-11-02 22:13:39 +0100
commiteb7e73db9258491c4a3aded30a410de30feb6e34 (patch)
tree79f805b017990fdc4d5e1a5900eacad0367f0d31 /scripts/templates
parentf410cf25256c6e2543dd85cb9dc6aa6026d8745c (diff)
Fix error in metamodel generation when initializing enum properties
Change-Id: If02783a7d51c0d98247114f02f4bad334c6d9fee Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'scripts/templates')
-rw-r--r--scripts/templates/qclass.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/templates/qclass.cpp b/scripts/templates/qclass.cpp
index d832ce7e..4dadbdbb 100644
--- a/scripts/templates/qclass.cpp
+++ b/scripts/templates/qclass.cpp
@@ -89,6 +89,7 @@ Q${namespace}${className}::Q${namespace}${className}([%- IF class.findvalue("@is
[%- FOREACH attribute = class.findnodes("ownedAttribute[(@isDerived=\"false\" or not(@isDerived)) or (@isDerivedUnion and @isDerivedUnion=\"true\")]") -%]
[%- SET defaultType = attribute.findvalue("defaultValue/@xmi:type") -%]
[%- SET type = QT_TYPE(namespace, attribute) -%]
+ [%- SET originalType = attribute.findvalue("@type") -%]
[%- IF defaultType == "uml:LiteralBoolean" || defaultType == "uml:InstanceValue" || defaultType == "uml:LiteralInteger" || defaultType == "uml:LiteralUnlimitedNatural" || type.match('\*$') -%]
[%- IF found == "false" %] :
[% SET found = "true" -%]
@@ -121,12 +122,12 @@ Q${namespace}${className}::Q${namespace}${className}([%- IF class.findvalue("@is
[%- ELSIF type.match('\*$') -%]
_[% QT_ATTRIBUTE(attribute) %](0)
[%- END -%]
- [%- ELSIF xmi.findvalue("//packagedElement[@xmi:id=\"${type}\"]/xmi:type") == "uml:Enumeration" -%]
+ [%- ELSIF xmi.findvalue("//packagedElement[@xmi:id=\"${originalType}\"]/@xmi:type") == "uml:Enumeration" -%]
[%- IF found == "false" %] :
[% SET found = "true" -%]
[%- ELSE %],
[% END -%]
- _[% QT_ATTRIBUTE(attribute) %](Qt${namespace}::${type}None)
+ _[% QT_ATTRIBUTE(attribute) %](Qt${namespace}::${originalType}None)
[%- END -%]
[%- END %]
{