diff options
author | Sandro S. Andrade <sandroandrade@kde.org> | 2013-10-09 20:19:34 -0300 |
---|---|---|
committer | Sandro S. Andrade <sandroandrade@kde.org> | 2013-10-10 01:23:16 +0200 |
commit | dc76a0dc87fe7ee0f94e96881990a4e83911fd8e (patch) | |
tree | f5b0731e183ecfe8c8d0a888a966508984d921db /scripts/templates | |
parent | 01ae27fe58be35914b0c4f573782f90242a9bfd9 (diff) |
Further refactoring in QtModeling (initial step)
Change-Id: Id8ca8a50edefeeb5c71206e96adbc4777eb82ccd
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'scripts/templates')
-rw-r--r-- | scripts/templates/common.tmpl | 10 | ||||
-rw-r--r-- | scripts/templates/qclass.cpp | 11 | ||||
-rw-r--r-- | scripts/templates/qclass.h | 2 |
3 files changed, 14 insertions, 9 deletions
diff --git a/scripts/templates/common.tmpl b/scripts/templates/common.tmpl index 75b1a0b7..a9d5089c 100644 --- a/scripts/templates/common.tmpl +++ b/scripts/templates/common.tmpl @@ -469,20 +469,22 @@ void Q${namespace}${originalClassName}Object::unset${qtAttribute.remove("^is").u [%- END -%] [%- END %] [%- END -%] -[%- MACRO SET_CLASS_FOR_PROPERTY(class, visitedClasses, redefinedProperties) BLOCK -%] +[%- MACRO SET_GROUP_PROPERTIES(class, visitedClasses, redefinedProperties) BLOCK -%] [%- FOREACH parent IN class.findnodes("generalization") -%] [%- SET parentName = parent.findvalue("@general") -%] [%- IF visitedClasses.grep("^${parentName}$").size == 0 -%] [%- visitedClasses.push("${parentName}") -%] - [%- SET_CLASS_FOR_PROPERTY(xmi.findnodes("//packagedElement[@xmi:type=\"uml:Class\" and @name=\"${parentName}\"]"), visitedClasses, redefinedProperties) -%] + [%- SET_GROUP_PROPERTIES(xmi.findnodes("//packagedElement[@xmi:type=\"uml:Class\" and @name=\"${parentName}\"]"), visitedClasses, redefinedProperties) -%] [%- END -%] [%- END -%] -[%- SET className = class.findvalue("@name") -%] +[%- SET className = class.findvalue("@name") %] + + _propertyGroups << QStringLiteral("Q${namespace}${className}"); [%- FOREACH attribute = class.findnodes("ownedAttribute") -%] [%- SET qtType = QT_TYPE(namespace, attribute) -%] [%- SET attributeName = attribute.findvalue("@name") -%] [%- SET qtAttribute = QT_ATTRIBUTE(attribute) -%] [%- NEXT IF redefinedProperties.grep("^${className}-${qtAttribute}$").size > 0 %] - _classForProperty[QStringLiteral("${PLURALFORM(qtAttribute, attribute)}")] = QStringLiteral("Q${namespace}${className}"); + _groupProperties.insert(QStringLiteral("Q${namespace}${className}"), new QMetaProperty(metaObject->property(metaObject->indexOfProperty("${PLURALFORM(qtAttribute, attribute)}")))); [%- END %] [%- END -%]
\ No newline at end of file diff --git a/scripts/templates/qclass.cpp b/scripts/templates/qclass.cpp index 8e07522f..c04d163a 100644 --- a/scripts/templates/qclass.cpp +++ b/scripts/templates/qclass.cpp @@ -121,7 +121,7 @@ Q${namespace}${className}::Q${namespace}${className}([%- IF class.findvalue("@is if (createQObject) _qObject = new Q${namespace}${className}Object(this); [%- END %] - setClassForProperty(); + setGroupProperties(); setPropertyData(); } @@ -404,11 +404,14 @@ ${parameter.findvalue("@name")} } [%- END %] -void Q${namespace}${className}::setClassForProperty() +void Q${namespace}${className}::setGroupProperties() { - _classForProperty[QStringLiteral("objectName")] = QStringLiteral("QObject"); + const QMetaObject *metaObject = _qObject->metaObject(); + + _propertyGroups << QStringLiteral("QObject"); + _groupProperties.insert(QStringLiteral("QObject"), new QMetaProperty(metaObject->property(metaObject->indexOfProperty("objectName")))); [%- visitedClasses = [] -%] -[%- SET_CLASS_FOR_PROPERTY(class, visitedClasses, redefinedProperties) %] +[%- SET_GROUP_PROPERTIES(class, visitedClasses, redefinedProperties) %] } void Q${namespace}${className}::setPropertyData() diff --git a/scripts/templates/qclass.h b/scripts/templates/qclass.h index 9e5d1b18..58953164 100644 --- a/scripts/templates/qclass.h +++ b/scripts/templates/qclass.h @@ -141,7 +141,7 @@ protected: [% QT_TYPE(namespace, attribute) -%]_[%- PLURALFORM(QT_ATTRIBUTE(attribute), attribute) %]; [%- END %] - virtual void setClassForProperty(); + virtual void setGroupProperties(); virtual void setPropertyData(); }; |