aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/abstractmetalang.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/ApiExtractor/abstractmetalang.cpp')
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetalang.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetalang.cpp b/sources/shiboken6/ApiExtractor/abstractmetalang.cpp
index 1ae0e1f1a..77d346a9d 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetalang.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetalang.cpp
@@ -69,6 +69,7 @@ public:
bool isUsingMember(const AbstractMetaClass *c, const QString &memberName,
Access minimumAccess) const;
bool hasConstructors() const;
+ qsizetype indexOfProperty(const QString &name) const;
uint m_hasVirtuals : 1;
uint m_isPolymorphic : 1;
@@ -355,6 +356,13 @@ void AbstractMetaClass::addPropertySpec(const QPropertySpec &spec)
d->m_propertySpecs << spec;
}
+void AbstractMetaClass::setPropertyDocumentation(const QString &name, const Documentation &doc)
+{
+ const auto index = d->indexOfProperty(name);
+ if (index >= 0)
+ d->m_propertySpecs[index].setDocumentation(doc);
+}
+
void AbstractMetaClassPrivate::addFunction(const AbstractMetaFunctionCPtr &function)
{
Q_ASSERT(!function->signature().startsWith(u'('));
@@ -672,10 +680,9 @@ AbstractMetaClass::PropertyFunctionSearchResult
std::optional<QPropertySpec>
AbstractMetaClass::propertySpecByName(const QString &name) const
{
- for (const auto &propertySpec : d->m_propertySpecs) {
- if (name == propertySpec.name())
- return propertySpec;
- }
+ const auto index = d->indexOfProperty(name);
+ if (index >= 0)
+ return d->m_propertySpecs.at(index);
return {};
}
@@ -760,6 +767,15 @@ bool AbstractMetaClassPrivate::hasConstructors() const
FunctionQueryOption::AnyConstructor) != nullptr;
}
+qsizetype AbstractMetaClassPrivate::indexOfProperty(const QString &name) const
+{
+ for (qsizetype i = 0; i < m_propertySpecs.size(); ++i) {
+ if (m_propertySpecs.at(i).name() == name)
+ return i;
+ }
+ return -1;
+}
+
bool AbstractMetaClass::hasConstructors() const
{
return d->hasConstructors();