Commit 924da63d authored by Kai Koehne's avatar Kai Koehne
Browse files

QuickDesigner: Fully implement versioning support in metatype system

Store qml versions in the metatype system. Instead of just assuming
e.g. "4, 6" or "4, 7" as default, support passing "-1, -1" as versioning
wildcard.

When inspecting the qml meta type system, versions are now stored also
for types that have no qml name / version. The version of the referenting
type is then taken, e.g. there are now entries for "Qt/Object", 4, 7 and
"Qt/Object", 1, 0 (from QmlProject, 1, 0).

Furthermore, some unused methods were removed, and the logic changed insofar
as that a type can have only one direct super type.

Reviewed-by: Thomas Hartmann
Reviewed-by: Marco Bubke
parent 6be9d180
......@@ -74,12 +74,8 @@ public:
~MetaInfo();
MetaInfo& operator=(const MetaInfo &other);
bool hasNodeMetaInfo(const QString &typeName, int majorVersion = 4, int minorVersion = 6) const;
NodeMetaInfo nodeMetaInfo(const QString &typeName, int majorVersion = 4, int minorVersion = 6) const;
// TODO: Move these to private
bool isSubclassOf(const QString &className, const QString &superClassName) const;
bool isSubclassOf(const ModelNode &modelNode, const QString &superClassName) const;
bool hasNodeMetaInfo(const QString &typeName, int majorVersion = -1, int minorVersion = -1) const;
NodeMetaInfo nodeMetaInfo(const QString &typeName, int majorVersion = -1, int minorVersion = -1) const;
bool hasEnumerator(const QString &enumeratorName) const;
EnumeratorMetaInfo enumerator(const QString &enumeratorName) const;
......@@ -96,16 +92,8 @@ public:
static void setPluginPaths(const QStringList &paths);
private:
QStringList superClasses(const QString &className) const;
QStringList directSuperClasses(const QString &className) const;
QList<NodeMetaInfo> superClasses(const NodeMetaInfo &nodeMetaInfo) const;
QList<NodeMetaInfo> directSuperClasses(const NodeMetaInfo &nodeMetaInfo) const;
void addSuperClassRelationship(const QString &superClassName, const QString &className);
void addNodeInfo(NodeMetaInfo &info, const QString &baseType);
void addNodeInfo(NodeMetaInfo &info);
void removeNodeInfo(NodeMetaInfo &info);
void replaceNodeInfo(NodeMetaInfo &oldInfo, NodeMetaInfo &newInfo, const QString &baseType);
EnumeratorMetaInfo addEnumerator(const QString &enumeratorScope, const QString &enumeratorName);
EnumeratorMetaInfo addFlag(const QString &enumeratorScope, const QString &enumeratorName);
......
......@@ -62,7 +62,6 @@ protected:
void handleFlagElement(QXmlStreamReader &reader);
void handleFlagElementElement(QXmlStreamReader &reader, EnumeratorMetaInfo &enumeratorMetaInfo);
void handleNodeElement(QXmlStreamReader &reader);
void handleNodeInheritElement(QXmlStreamReader &reader, const QString &className);
void handleNodeItemLibraryEntryElement(QXmlStreamReader &reader, const QString &className);
void handleAbstractPropertyElement(QXmlStreamReader &reader, NodeMetaInfo &nodeMetaInfo);
void handleAbstractPropertyDefaultValueElement(QXmlStreamReader &reader, NodeMetaInfo &nodeMetaInfo);
......
......@@ -82,26 +82,22 @@ public:
PropertyMetaInfo property(const QString &propertyName, bool resolveDotSyntax = false) const;
QList<NodeMetaInfo> superClasses() const;
QList<NodeMetaInfo> directSuperClasses() const;
NodeMetaInfo directSuperClass() const;
QHash<QString,PropertyMetaInfo> properties(bool resolveDotSyntax = false) const;
QString typeName() const;
int majorVersion() const;
int minorVersion() const;
bool availableInVersion(int majorVersion, int minorVersion) const;
bool hasDefaultProperty() const;
QString defaultProperty() const;
bool hasProperty(const QString &propertyName, bool resolveDotSyntax = false) const;
bool isContainer() const;
bool isWidget() const;
bool isGraphicsWidget() const;
bool isGraphicsObject() const;
bool isQmlGraphicsItem() const;
bool isComponent() const;
bool isSubclassOf(const QString& type, int majorVersion = 4, int minorVersion = 6) const;
bool isSubclassOf(const QString& type, int majorVersion, int minorVersio) const;
QIcon icon() const;
......@@ -110,14 +106,13 @@ private:
NodeMetaInfo(const MetaInfo &metaInfo);
void setInvalid();
void setTypeName(const QString &typeName);
void setType(const QString &typeName, int majorVersion, int minorVersion);
void addProperty(const PropertyMetaInfo &property);
void setIsContainer(bool isContainer);
void setIcon(const QIcon &icon);
void setQmlFile(const QString &filePath);
void setDefaultProperty(const QString &defaultProperty);
void setMajorVersion(int version);
void setMinorVersion(int version);
void setSuperClass(const QString &typeName, int majorVersion = -1, int minorVersion = -1);
bool hasLocalProperty(const QString &propertyName, bool resolveDotSyntax = false) const;
QHash<QString,PropertyMetaInfo> dotProperties() const;
......
......@@ -71,7 +71,7 @@ public:
void parseQmlTypes();
void parseNonQmlTypes();
void parseValueTypes();
void parseNonQmlClassRecursively(const QMetaObject *qMetaObject);
void parseNonQmlClassRecursively(const QMetaObject *qMetaObject, int majorVersion, int minorVersion);
void parseProperties(NodeMetaInfo &nodeMetaInfo, const QMetaObject *qMetaObject) const;
void parseClassInfo(NodeMetaInfo &nodeMetaInfo, const QMetaObject *qMetaObject) const;
......@@ -79,8 +79,7 @@ public:
void parseXmlFiles();
QMultiHash<QString, QString> m_superClassHash; // the list of direct superclasses
QHash<QString, NodeMetaInfo> m_nodeMetaInfoHash;
QMultiHash<QString, NodeMetaInfo> m_nodeMetaInfoHash;
QHash<QString, EnumeratorMetaInfo> m_enumeratorMetaInfoHash;
QHash<QString, QString> m_QtTypesToQmlTypes;
QScopedPointer<ItemLibraryInfo> m_itemLibraryInfo;
......@@ -100,7 +99,6 @@ MetaInfoPrivate::MetaInfoPrivate(MetaInfo *q) :
void MetaInfoPrivate::clear()
{
m_superClassHash.clear();
m_nodeMetaInfoHash.clear();
m_enumeratorMetaInfoHash.clear();
m_itemLibraryInfo->clearEntries();
......@@ -188,7 +186,7 @@ void MetaInfoPrivate::parseClassInfo(NodeMetaInfo &nodeMetaInfo, const QMetaObje
}
}
void MetaInfoPrivate::parseNonQmlClassRecursively(const QMetaObject *qMetaObject)
void MetaInfoPrivate::parseNonQmlClassRecursively(const QMetaObject *qMetaObject, int majorVersion, int minorVersion)
{
Q_ASSERT_X(qMetaObject, Q_FUNC_INFO, "invalid QMetaObject");
const QString className = qMetaObject->className();
......@@ -198,20 +196,22 @@ void MetaInfoPrivate::parseNonQmlClassRecursively(const QMetaObject *qMetaObject
return;
}
if ( !m_q->hasNodeMetaInfo(className)
&& !QDeclarativeMetaType::qmlTypeNames().contains(typeName(qMetaObject).toAscii()) ) {
if (!m_q->hasNodeMetaInfo(typeName(qMetaObject), majorVersion, minorVersion)) {
NodeMetaInfo nodeMetaInfo(*m_q);
nodeMetaInfo.setTypeName(typeName(qMetaObject));
nodeMetaInfo.setType(typeName(qMetaObject), majorVersion, minorVersion);
parseProperties(nodeMetaInfo, qMetaObject);
parseClassInfo(nodeMetaInfo, qMetaObject);
if (debug)
qDebug() << "adding non qml type" << className << typeName(qMetaObject) << ", parent type" << typeName(qMetaObject->superClass());
m_q->addNodeInfo(nodeMetaInfo, typeName(qMetaObject->superClass()));
qDebug() << "adding non qml type" << nodeMetaInfo.typeName() << nodeMetaInfo.majorVersion() << nodeMetaInfo.minorVersion() << ", parent type" << typeName(qMetaObject->superClass());
if (qMetaObject->superClass())
nodeMetaInfo.setSuperClass(typeName(qMetaObject->superClass()));
m_q->addNodeInfo(nodeMetaInfo);
}
if (const QMetaObject *superClass = qMetaObject->superClass()) {
parseNonQmlClassRecursively(superClass);
parseNonQmlClassRecursively(superClass, majorVersion, minorVersion);
}
}
......@@ -245,7 +245,7 @@ void MetaInfoPrivate::parseValueTypes()
foreach (const QString &type, valueTypes) {
NodeMetaInfo nodeMetaInfo(*m_q);
nodeMetaInfo.setTypeName(type);
nodeMetaInfo.setType(type, -1, -1);
foreach (const QString &propertyName, VariantParser::create(type).properties()) {
PropertyMetaInfo propertyInfo;
propertyInfo.setName(propertyName);
......@@ -277,7 +277,7 @@ void MetaInfoPrivate::parseValueTypes()
}
if (debug)
qDebug() << "adding value type" << nodeMetaInfo.typeName();
m_q->addNodeInfo(nodeMetaInfo, QString());
m_q->addNodeInfo(nodeMetaInfo);
}
}
......@@ -296,9 +296,7 @@ void MetaInfoPrivate::parseQmlTypes()
continue;
NodeMetaInfo nodeMetaInfo(*m_q);
nodeMetaInfo.setTypeName(qmlType->qmlTypeName());
nodeMetaInfo.setMajorVersion(qmlType->majorVersion());
nodeMetaInfo.setMinorVersion(qmlType->minorVersion());
nodeMetaInfo.setType(qmlType->qmlTypeName(), qmlType->majorVersion(), qmlType->minorVersion());
parseProperties(nodeMetaInfo, qMetaObject);
parseClassInfo(nodeMetaInfo, qMetaObject);
......@@ -311,7 +309,11 @@ void MetaInfoPrivate::parseQmlTypes()
superTypeName = typeName(qmlType->baseMetaObject()->superClass());
}
m_q->addNodeInfo(nodeMetaInfo, superTypeName);
nodeMetaInfo.setSuperClass(superTypeName);
if (debug)
qDebug() << "adding qml type" << nodeMetaInfo.typeName() << nodeMetaInfo.majorVersion() << nodeMetaInfo.minorVersion() << "super class" << superTypeName;
m_q->addNodeInfo(nodeMetaInfo);
}
}
......@@ -319,10 +321,10 @@ void MetaInfoPrivate::parseNonQmlTypes()
{
foreach (QDeclarativeType *qmlType, QDeclarativeMetaType::qmlTypes()) {
if (!qmlType->qmlTypeName().contains("Bauhaus"))
parseNonQmlClassRecursively(qmlType->metaObject());
parseNonQmlClassRecursively(qmlType->metaObject(), qmlType->majorVersion(), qmlType->minorVersion());
}
parseNonQmlClassRecursively(&QDeclarativeAnchors::staticMetaObject);
parseNonQmlClassRecursively(&QDeclarativeAnchors::staticMetaObject, -1, -1);
}
......@@ -404,10 +406,13 @@ MetaInfo& MetaInfo::operator=(const MetaInfo &other)
/*!
\brief Returns whether a type with the given name is registered in the meta system.
*/
bool MetaInfo::hasNodeMetaInfo(const QString &typeName, int /*majorVersion*/, int /*minorVersion*/) const
bool MetaInfo::hasNodeMetaInfo(const QString &typeName, int majorVersion, int minorVersion) const
{
if (m_p->m_nodeMetaInfoHash.contains(typeName))
return true;
foreach (const NodeMetaInfo &info, m_p->m_nodeMetaInfoHash.values(typeName)) {
if (info.availableInVersion(majorVersion, minorVersion)) {
return true;
}
}
if (!isGlobal())
return global().hasNodeMetaInfo(typeName);
return false;
......@@ -416,75 +421,20 @@ bool MetaInfo::hasNodeMetaInfo(const QString &typeName, int /*majorVersion*/, in
/*!
\brief Returns meta information for a qml type. An invalid NodeMetaInfo object if the type is unknown.
*/
NodeMetaInfo MetaInfo::nodeMetaInfo(const QString &typeName, int /*majorVersion*/, int /*minorVersion*/) const
NodeMetaInfo MetaInfo::nodeMetaInfo(const QString &typeName, int majorVersion, int minorVersion) const
{
if (m_p->m_nodeMetaInfoHash.contains(typeName))
return m_p->m_nodeMetaInfoHash.value(typeName, NodeMetaInfo());
foreach (const NodeMetaInfo &info, m_p->m_nodeMetaInfoHash.values(typeName)) {
// todo: The order for different types for different versions is random here.
if (info.availableInVersion(majorVersion, minorVersion)) {
return info;
}
}
if (!isGlobal())
return global().nodeMetaInfo(typeName);
return NodeMetaInfo();
}
QStringList MetaInfo::superClasses(const QString &className) const
{
QStringList ancestorList = m_p->m_superClassHash.values(className);
foreach (const QString &ancestor, ancestorList) {
QStringList superClassList = superClasses(ancestor);
if (!superClassList.isEmpty())
ancestorList += superClassList;
}
if (!isGlobal())
ancestorList += global().superClasses(className);
return ancestorList;
}
QStringList MetaInfo::directSuperClasses(const QString &className) const
{
QStringList directAncestorList = m_p->m_superClassHash.values(className);
if (!isGlobal())
directAncestorList += global().directSuperClasses(className);
return directAncestorList;
}
QList<NodeMetaInfo> MetaInfo::superClasses(const NodeMetaInfo &nodeInfo) const
{
if (!nodeInfo.isValid()) {
qWarning() << "NodeMetaInfo is invalid";
return QList<NodeMetaInfo>();
}
QList<NodeMetaInfo> superClassList;
foreach (const QString &typeName, superClasses(nodeInfo.typeName())) {
if (!hasNodeMetaInfo(typeName))
continue;
const NodeMetaInfo superClass = nodeMetaInfo(typeName);
if (!superClassList.contains(superClass))
superClassList.append(superClass);
}
return superClassList;
}
QList<NodeMetaInfo> MetaInfo::directSuperClasses(const NodeMetaInfo &nodeInfo) const
{
if (!nodeInfo.isValid()) {
qWarning() << "NodeMetaInfo is invalid";
return QList<NodeMetaInfo>();
}
QList<NodeMetaInfo> superClassList;
foreach (const QString &typeName, directSuperClasses(nodeInfo.typeName())) {
if (!hasNodeMetaInfo(typeName))
continue;
const NodeMetaInfo superClass = nodeMetaInfo(typeName);
if (!superClassList.contains(superClass))
superClassList.append(superClass);
}
return superClassList;
}
QString MetaInfo::fromQtTypes(const QString &type) const
{
if (m_p->m_QtTypesToQmlTypes.contains(type))
......@@ -493,27 +443,6 @@ QString MetaInfo::fromQtTypes(const QString &type) const
return type;
}
/*!
\brief Returns whether className is the same type or a type derived from superClassName.
*/
bool MetaInfo::isSubclassOf(const QString &className, const QString &superClassName) const
{
return (className == superClassName) || superClasses(className).contains(superClassName);
}
/*!
\brief Returns whether the type of modelNode is the same type or a type derived from superClassName.
\throws InvalidModelNode if !modelNode.isValid()
*/
bool MetaInfo::isSubclassOf(const ModelNode &modelNode, const QString &superClassName) const
{
if (!modelNode.isValid()) {
Q_ASSERT_X(modelNode.isValid(), Q_FUNC_INFO, "Invalid modelNode argument");
throw InvalidModelNodeException(__LINE__, __FUNCTION__, __FILE__);
}
return (modelNode.type() == superClassName) || isSubclassOf(modelNode.type(), superClassName);
}
/*!
\brief Returns whether an enumerator is registered in the meta type system.
*/
......@@ -573,28 +502,13 @@ void MetaInfo::setPluginPaths(const QStringList &paths)
s_pluginDirs = paths;
}
/*!
This bypasses the notifications to the model that the metatype has changed.
Use MetaInfo::addNodeInfo() instead
*/
void MetaInfo::addSuperClassRelationship(const QString &superClassName, const QString &className)
{
m_p->m_superClassHash.insert(className, superClassName);
}
void MetaInfo::addNodeInfo(NodeMetaInfo &nodeInfo, const QString &baseType)
void MetaInfo::addNodeInfo(NodeMetaInfo &nodeInfo)
{
if (nodeInfo.typeName().isEmpty() || nodeInfo.metaInfo() != *this)
throw new InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, QLatin1String("nodeInfo"));
if (nodeInfo.typeName() == baseType) // prevent simple recursion
throw new InvalidArgumentException(__LINE__, __FUNCTION__, __FILE__, QLatin1String("baseType"));
m_p->m_nodeMetaInfoHash.insert(nodeInfo.typeName(), nodeInfo);
if (!baseType.isEmpty()) {
m_p->m_superClassHash.insert(nodeInfo.typeName(), baseType);
}
m_p->m_nodeMetaInfoHash.insertMulti(nodeInfo.typeName(), nodeInfo);
}
void MetaInfo::removeNodeInfo(NodeMetaInfo &info)
......@@ -604,11 +518,9 @@ void MetaInfo::removeNodeInfo(NodeMetaInfo &info)
return;
}
if (m_p->m_nodeMetaInfoHash.contains(info.typeName())) {
m_p->m_nodeMetaInfoHash.remove(info.typeName());
if (m_p->m_nodeMetaInfoHash.contains(info.typeName())
&& m_p->m_nodeMetaInfoHash.remove(info.typeName(), info)) {
m_p->m_superClassHash.remove(info.typeName());
// TODO: Other types might specify type as parent type
foreach (const ItemLibraryEntry &entry,
m_p->m_itemLibraryInfo->entriesForType(info.typeName(), info.majorVersion(), info.minorVersion())) {
m_p->m_itemLibraryInfo->removeEntry(entry.name());
......@@ -623,11 +535,6 @@ void MetaInfo::removeNodeInfo(NodeMetaInfo &info)
info.setInvalid();
}
void MetaInfo::replaceNodeInfo(NodeMetaInfo & /*oldInfo*/, NodeMetaInfo & /*newInfo*/, const QString & /*baseType*/)
{
// TODO
}
EnumeratorMetaInfo MetaInfo::addEnumerator(const QString &enumeratorScope, const QString &enumeratorName)
{
Q_ASSERT(!enumeratorName.isEmpty());
......
......@@ -187,7 +187,6 @@ void MetaInfoParser::handleNodeElement(QXmlStreamReader &reader)
while (!reader.atEnd() && !(reader.isEndElement() && reader.name() == "node")) {
reader.readNext();
handleNodeInheritElement(reader, className);
handleAbstractPropertyElement(reader, nodeMetaInfo);
handleAbstractPropertyDefaultValueElement(reader, nodeMetaInfo);
handleNodeItemLibraryEntryElement(reader, className);
......@@ -222,17 +221,6 @@ void MetaInfoParser::handleNodeItemLibraryEntryElement(QXmlStreamReader &reader,
}
}
void MetaInfoParser::handleNodeInheritElement(QXmlStreamReader &reader, const QString &className)
{
if (reader.isStartElement() && reader.name() == "inherits")
{
QString superClassName = reader.attributes().value("name").toString();
Q_ASSERT(!superClassName.isEmpty());
m_metaInfo.addSuperClassRelationship(superClassName, className);
reader.readNext();
}
}
void MetaInfoParser::handleItemLibraryEntryPropertyElement(QXmlStreamReader &reader, ItemLibraryEntry &itemLibraryEntry)
{
if (reader.isStartElement() && reader.name() == "property")
......
......@@ -76,6 +76,11 @@ public:
QString category;
QString qmlFile;
QString defaultProperty;
QString superClassType;
int superClassMajorVersion;
int superClassMinorVersion;
int majorVersion;
int minorVersion;
};
......@@ -179,7 +184,7 @@ QObject *NodeMetaInfo::createInstance(QDeclarativeContext *context) const
newContext->setParent(object);
} else {
// primitive
object = QDeclarativeMetaType::qmlType(typeName().toAscii(), minorVersion(), majorVersion())->create();
object = QDeclarativeMetaType::qmlType(typeName().toAscii(), majorVersion(), minorVersion())->create();
if (object && context)
QDeclarativeEngine::setContextForObject(object, context);
}
......@@ -198,22 +203,39 @@ QList<NodeMetaInfo> NodeMetaInfo::superClasses() const
return QList<NodeMetaInfo>();
}
return m_data->metaInfo.superClasses(*this);
QList<NodeMetaInfo> types;
NodeMetaInfo superType = directSuperClass();
if (superType.isValid()) {
types += superType;
types += superType.superClasses();
}
return types;
}
/*!
\brief Returns direct ancestor types.
\throws InvalidMetaInfoException if the object is not valid
\brief Returns direct ancestor type. An invalid type if there is none.
*/
QList<NodeMetaInfo> NodeMetaInfo::directSuperClasses() const
NodeMetaInfo NodeMetaInfo::directSuperClass() const
{
if (!isValid()) {
qWarning() << "NodeMetaInfo is invalid";
return QList<NodeMetaInfo>();
return NodeMetaInfo();
}
return m_data->metaInfo.directSuperClasses(*this);
if (!m_data->superClassType.isEmpty()) {
int superClassMajorVersion = m_data->superClassMajorVersion;
int superClassMinorVersion = m_data->superClassMinorVersion;
if (superClassMajorVersion == -1) {
// If we don't know the version of the super type, assume that it's the same like our version.
superClassMajorVersion = majorVersion();
superClassMinorVersion = minorVersion();
}
return m_data->metaInfo.nodeMetaInfo(m_data->superClassType,
superClassMajorVersion, superClassMinorVersion);
}
return NodeMetaInfo();
}
/*!
......@@ -225,7 +247,7 @@ QList<NodeMetaInfo> NodeMetaInfo::directSuperClasses() const
\throws InvalidMetaInfoException if the object is not valid
*/
QHash<QString,PropertyMetaInfo> NodeMetaInfo::properties(bool resolveDotSyntax ) const
QHash<QString,PropertyMetaInfo> NodeMetaInfo::properties(bool resolveDotSyntax) const
{
if (!isValid()) {
qWarning() << "NodeMetaInfo is invalid";
......@@ -234,7 +256,8 @@ QHash<QString,PropertyMetaInfo> NodeMetaInfo::properties(bool resolveDotSyntax )
QHash<QString,PropertyMetaInfo> propertiesInfo;
propertiesInfo = m_data->propertyMetaInfoHash;
foreach (const NodeMetaInfo &nodeInfo, directSuperClasses()) {
foreach (const NodeMetaInfo &nodeInfo, superClasses()) {
QHash<QString,PropertyMetaInfo> superClassProperties = nodeInfo.properties();
QHashIterator<QString,PropertyMetaInfo> iter(superClassProperties);
while (iter.hasNext()) {
......@@ -318,7 +341,7 @@ PropertyMetaInfo NodeMetaInfo::property(const QString &propertyName, bool resolv
propertyType = propertyType.left(propertyType.size() - 1).trimmed();
nodeInfo = m_data->metaInfo.nodeMetaInfo(m_data->metaInfo.fromQtTypes(propertyType), majorVersion(), minorVersion());
if (!nodeInfo.isValid()) {
qDebug() << "no type info available for" << propertyType;
qWarning() << "no type info available for" << propertyType;
break;
}
}
......@@ -330,7 +353,7 @@ PropertyMetaInfo NodeMetaInfo::property(const QString &propertyName, bool resolv
if (hasLocalProperty(propertyName)) {
propertyMetaInfo = m_data->propertyMetaInfoHash.value(propertyName, PropertyMetaInfo());
} else {
foreach (const NodeMetaInfo &superTypeMetaInfo, directSuperClasses()) {
foreach (const NodeMetaInfo &superTypeMetaInfo, superClasses()) {
Q_ASSERT(superTypeMetaInfo.isValid());
propertyMetaInfo = superTypeMetaInfo.property(propertyName);
if (propertyMetaInfo.isValid())
......@@ -373,7 +396,7 @@ bool NodeMetaInfo::hasLocalProperty(const QString &propertyName, bool resolveDot
propertyType = propertyType.left(propertyType.size() - 1).trimmed();
nodeInfo = m_data->metaInfo.nodeMetaInfo(m_data->metaInfo.fromQtTypes(propertyType), majorVersion(), minorVersion());
if (!nodeInfo.isValid()) {
qDebug() << "no type info available for" << propertyType;
qWarning() << "no type info available for" << propertyType;
break;
}
}
......@@ -399,10 +422,8 @@ bool NodeMetaInfo::hasProperty(const QString &propertyName, bool resolveDotSynta
if (hasLocalProperty(propertyName, resolveDotSyntax))
return true;
foreach (const NodeMetaInfo &nodeMetaInfo, directSuperClasses()) {
if (nodeMetaInfo.hasProperty(propertyName, resolveDotSyntax))
return true;
}
if (directSuperClass().hasProperty(propertyName, resolveDotSyntax))
return true;
return false;
}
......@@ -443,7 +464,7 @@ int NodeMetaInfo::majorVersion() const
return -1;
}
return 4;
return m_data->majorVersion;
}
......@@ -461,6 +482,13 @@ int NodeMetaInfo::minorVersion() const
return m_data->minorVersion;
}
bool NodeMetaInfo::availableInVersion(int majorVersion, int minorVersion) const
{
return ((majorVersion > m_data->majorVersion)
|| (majorVersion == m_data->majorVersion && minorVersion >= m_data->minorVersion))
|| (majorVersion == -1 && minorVersion == -1);
}
bool NodeMetaInfo::hasDefaultProperty() const
{
if (!isValid()) {
......@@ -488,14 +516,14 @@ void NodeMetaInfo::setDefaultProperty(const QString &defaultProperty)
m_data->defaultProperty = defaultProperty;
}
void NodeMetaInfo::setMajorVersion(int version)
{
m_data->majorVersion = version;
}
void NodeMetaInfo::setMinorVersion(int version)
void NodeMetaInfo::setSuperClass(const QString &typeName, int majorVersion, int minorVersion)
{
m_data->minorVersion = version;
if (!isValid()) {
return;
}
m_data->superClassType = typeName;
m_data->superClassMajorVersion = majorVersion;
m_data->superClassMinorVersion = minorVersion;
}
void NodeMetaInfo::setInvalid()
......@@ -506,13 +534,15 @@ void NodeMetaInfo::setInvalid()