diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2021-05-28 11:11:08 +0200 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2021-06-02 19:03:45 +0200 |
commit | e6a2892772c9ea18a941625b2b8dec38e6774f82 (patch) | |
tree | 4248dd3057d7a7b236ac86f972dc6fe7e4a25ab1 /src/tools/moc/moc.cpp | |
parent | 6ef69bcef2785baf112b6f91f05995fc01869928 (diff) |
moc: Add relative property index to JSON output of PropertyDef
Needed for QML compiler to know property index of C++ type at
compile time without going through QMetaObject::indexOfProperty
Change-Id: I404e71d6071d36812661df17d12b879a8dcbd146
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/tools/moc/moc.cpp')
-rw-r--r-- | src/tools/moc/moc.cpp | 9 |
1 files changed, 5 insertions, 4 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; |