forked from qt-creator/qt-creator
QmlDesigner: Add ProjectStorage::propertyDeclarationId
The properties has to respect overloading. So it should chose the nearest property declaration with the requested name. Task-number: QDS-7280 Change-Id: I13ff9cf1f9389ec6b48c6e692368ef33795b61fe Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -151,18 +151,24 @@ public:
|
||||
.template valueWithTransaction<TypeId>(&moduleId, exportedTypeName);
|
||||
}
|
||||
|
||||
PropertyDeclarationIds propertyIds(TypeId typeId) const
|
||||
PropertyDeclarationIds propertyDeclarationIds(TypeId typeId) const
|
||||
{
|
||||
return selectPropertyDeclarationIdsForTypeStatement
|
||||
.template valuesWithTransaction<PropertyDeclarationId>(32, &typeId);
|
||||
}
|
||||
|
||||
PropertyDeclarationIds localPropertyIds(TypeId typeId) const
|
||||
PropertyDeclarationIds localPropertyDeclarationIds(TypeId typeId) const
|
||||
{
|
||||
return selectLocalPropertyDeclarationIdsForTypeStatement
|
||||
.template valuesWithTransaction<PropertyDeclarationId>(16, &typeId);
|
||||
}
|
||||
|
||||
PropertyDeclarationId propertyDeclarationId(TypeId typeId, Utils::SmallStringView propertyName) const
|
||||
{
|
||||
return selectPropertyDeclarationIdForTypeAndPropertyNameStatement
|
||||
.template valueWithTransaction<PropertyDeclarationId>(&typeId, propertyName);
|
||||
}
|
||||
|
||||
Utils::optional<Utils::SmallString> propertyName(PropertyDeclarationId propertyDeclarationId) const
|
||||
{
|
||||
return selectPropertyNameStatement.template optionalValueWithTransaction<Utils::SmallString>(
|
||||
@@ -2898,6 +2904,16 @@ public:
|
||||
"WHERE typeId=? "
|
||||
"ORDER BY propertyDeclarationId",
|
||||
database};
|
||||
mutable ReadStatement<1, 2> selectPropertyDeclarationIdForTypeAndPropertyNameStatement{
|
||||
"WITH RECURSIVE "
|
||||
" typeChain(typeId, level) AS ("
|
||||
" VALUES(?1, 0)"
|
||||
" UNION ALL "
|
||||
" SELECT prototypeId, typeChain.level + 1 FROM types JOIN typeChain "
|
||||
" USING(typeId) WHERE prototypeId IS NOT NULL)"
|
||||
"SELECT propertyDeclarationId FROM typeChain JOIN propertyDeclarations "
|
||||
" USING(typeId) WHERE name=?2 ORDER BY level LIMIT 1",
|
||||
database};
|
||||
};
|
||||
extern template class ProjectStorage<Sqlite::Database>;
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Reference in New Issue
Block a user