From bf3a54b93944ae86f82db2e49ccffe8efdaa3517 Mon Sep 17 00:00:00 2001 From: Lauro Neto Date: Tue, 5 Oct 2010 14:31:14 -0300 Subject: Better qproperty function check Now checking for the full specs: Getter: TYPE name(void) Setter: void name(TYPE) Resetter: void name(void) The previous behavior was crashing when there is a different overload with the same name of one of the property functions. Reviewer: Luciano Wolf Reviewer: Marcelo Lira --- abstractmetabuilder.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/abstractmetabuilder.cpp b/abstractmetabuilder.cpp index f90729ce1..60b687a63 100644 --- a/abstractmetabuilder.cpp +++ b/abstractmetabuilder.cpp @@ -1341,20 +1341,26 @@ void AbstractMetaBuilder::traverseFunctions(ScopeModelItem scopeItem, AbstractMe if (metaClass->isNamespace()) *metaFunction += AbstractMetaAttributes::Static; - if (QPropertySpec* read = metaClass->propertySpecForRead(metaFunction->name())) { - if (read->type() == metaFunction->type()->typeEntry()) { + QPropertySpec *read = 0; + if (!metaFunction->isSignal() && (read = metaClass->propertySpecForRead(metaFunction->name()))) { + // Property reader must be in the form " name()" + if (metaFunction->type() && (read->type() == metaFunction->type()->typeEntry()) && (metaFunction->arguments().size() == 0)) { *metaFunction += AbstractMetaAttributes::PropertyReader; metaFunction->setPropertySpec(read); } } else if (QPropertySpec* write = metaClass->propertySpecForWrite(metaFunction->name())) { + // Property setter must be in the form "void name()" // make sure the function was created with all aguments, some argument can be missing during the pareser because of errors on typesystem - if ((metaFunction->arguments().size() == 1) && (write->type() == metaFunction->arguments().at(0)->type()->typeEntry())) { + if ((!metaFunction->type()) && (metaFunction->arguments().size() == 1) && (write->type() == metaFunction->arguments().at(0)->type()->typeEntry())) { *metaFunction += AbstractMetaAttributes::PropertyWriter; metaFunction->setPropertySpec(write); } } else if (QPropertySpec* reset = metaClass->propertySpecForReset(metaFunction->name())) { - *metaFunction += AbstractMetaAttributes::PropertyResetter; - metaFunction->setPropertySpec(reset); + // Property resetter must be in the form "void name()" + if ((!metaFunction->type()) && (metaFunction->arguments().size() == 0)) { + *metaFunction += AbstractMetaAttributes::PropertyResetter; + metaFunction->setPropertySpec(reset); + } } // Can not use metaFunction->isCopyConstructor() because -- cgit v1.2.3