diff options
Diffstat (limited to 'src/tools/moc')
-rw-r--r-- | src/tools/moc/moc.cpp | 9 | ||||
-rw-r--r-- | src/tools/moc/moc.h | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index c8fe0e9a83..bce75644f5 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -1242,9 +1242,10 @@ void Moc::parseSignals(ClassDef *def) } } -void Moc::createPropertyDef(PropertyDef &propDef) +void Moc::createPropertyDef(PropertyDef &propDef, int propertyIndex) { propDef.location = index; + propDef.relativeIndex = propertyIndex; QByteArray type = parseType().name; if (type.isEmpty()) @@ -1401,7 +1402,7 @@ void Moc::parseProperty(ClassDef *def) { next(LPAREN); PropertyDef propDef; - createPropertyDef(propDef); + createPropertyDef(propDef, int(def->propertyList.size())); next(RPAREN); def->propertyList += propDef; @@ -1495,7 +1496,7 @@ void Moc::parsePrivateProperty(ClassDef *def) next(COMMA); - createPropertyDef(propDef); + createPropertyDef(propDef, int(def->propertyList.size())); def->propertyList += propDef; } @@ -2068,7 +2069,7 @@ QJsonObject PropertyDef::toJson() const prop[QLatin1String("constant")] = constant; prop[QLatin1String("final")] = final; prop[QLatin1String("required")] = required; - + prop[QLatin1String("index")] = relativeIndex; if (revision > 0) prop[QLatin1String("revision")] = revision; diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 889ee15652..1c2d6624fa 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -140,6 +140,7 @@ struct PropertyDef bool constant = false; bool final = false; bool required = false; + int relativeIndex = -1; // property index in current metaobject int location = -1; // token index, used for error reporting @@ -263,7 +264,7 @@ public: void parseSignals(ClassDef *def); void parseProperty(ClassDef *def); void parsePluginData(ClassDef *def); - void createPropertyDef(PropertyDef &def); + void createPropertyDef(PropertyDef &def, int propertyIndex); void parsePropertyAttributes(PropertyDef &propDef); void parseEnumOrFlag(BaseDef *def, bool isFlag); void parseFlag(BaseDef *def); |