aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-08-16 17:51:41 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2010-08-17 11:15:03 -0300
commit08027d04146bf528ac33a0686aa1a1a81312b9a3 (patch)
tree73ebd5e1fa7045c9adcb7b78a700b63b02d34dd4
parenta61017d620189108ab844ce9398f453f534de5f3 (diff)
Fix bug 294 - "If the function must return a QFlags<T> and you return T, an exception is throw."
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Renato Araújo <renato.filho@openbossa.org>
-rw-r--r--cppgenerator.cpp4
-rw-r--r--headergenerator.cpp4
2 files changed, 5 insertions, 3 deletions
diff --git a/cppgenerator.cpp b/cppgenerator.cpp
index 369ee409d..c899a4697 100644
--- a/cppgenerator.cpp
+++ b/cppgenerator.cpp
@@ -568,12 +568,12 @@ void CppGenerator::writeVirtualMethodNative(QTextStream &s, const AbstractMetaFu
}
s << INDENT << '}' << endl;
- if (func->type() && (!usePySideExtensions() || (func->type()->name() != "QVariant"))) {
+ if (func->type()) {
s << INDENT << "// Check return type" << endl;
s << INDENT << "bool typeIsValid = ";
QString desiredType;
if (func->typeReplaced(0).isEmpty()) {
- s << cpythonCheckFunction(func->type());
+ s << cpythonIsConvertibleFunction(func->type());
// SbkType would return null when the type is a container.
if (func->type()->typeEntry()->isContainer()) {
desiredType = '"' + reinterpret_cast<const ContainerTypeEntry*>(func->type()->typeEntry())->typeName() + '"';
diff --git a/headergenerator.cpp b/headergenerator.cpp
index 5e39ec95b..1c761639a 100644
--- a/headergenerator.cpp
+++ b/headergenerator.cpp
@@ -234,8 +234,10 @@ void HeaderGenerator::writeTypeConverterDecl(QTextStream& s, const TypeEntry* ty
s << "struct Converter<" << typeT << " >";
if (!hasCustomConversion) {
- if (type->isEnum() || type->isFlags())
+ if (type->isEnum())
s << " : EnumConverter";
+ else if (type->isFlags())
+ s << " : QFlagsConverter";
else if (isAbstractOrObjectType)
s << " : ObjectTypeConverter";
else