Skip to content

Commit ac0c4bf

Browse files
author
florianlink
committed
fixed return value
fixed wrong isValid negation git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@440 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
1 parent 7c9d965 commit ac0c4bf

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

generator/abstractmetalang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ QString AbstractMetaClass::getDefaultNonZeroFunction() const
855855
return "isNull";
856856
}
857857
}
858-
return false;
858+
return QString();
859859
}
860860

861861
/*******************************************************************************

generator/shellheadergenerator.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,11 @@ void ShellHeaderGenerator::write(QTextStream &s, const AbstractMetaClass *meta_c
397397
}
398398
QString nonZeroFunc = meta_class->getDefaultNonZeroFunction();
399399
if (!nonZeroFunc.isEmpty()) {
400-
s << " bool __nonzero__(" << meta_class->qualifiedCppName() << "* obj) { return !obj->" << nonZeroFunc << "(); }" << endl;
400+
s << " bool __nonzero__(" << meta_class->qualifiedCppName() << "* obj) { return ";
401+
if (nonZeroFunc != "isValid") {
402+
s << "!";
403+
}
404+
s << "obj->" << nonZeroFunc << "(); }" << endl;
401405
}
402406

403407
AbstractMetaFieldList fields = meta_class->fields();

0 commit comments

Comments
 (0)