diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-08-26 14:55:03 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:17:13 -0300 |
commit | 8b1ddcd3ef711bab70bb7cdebc26558a26f42df9 (patch) | |
tree | 6e363aa8f240e780350ad58a38eeab5ac6950f3c | |
parent | 26c49c0b87e0efc065bcb7667aad71231f769028 (diff) |
Implmented support to q_metacall function modification.
Reviewed by: Hugo Parente <hugo.lima@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r-- | generator/cppgenerator.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp index 43919888a..a894c79e7 100644 --- a/generator/cppgenerator.cpp +++ b/generator/cppgenerator.cpp @@ -361,7 +361,8 @@ void CppGenerator::generateClass(QTextStream &s, const AbstractMetaClass *metaCl && !func->isCastOperator() && !func->isModifiedRemoved() && (!func->isPrivate() || func->functionType() == AbstractMetaFunction::EmptyFunction) - && func->ownerClass() == func->implementingClass()) + && func->ownerClass() == func->implementingClass() + && (func->name() != "qt_metacall")) overloads.append(func); } @@ -890,11 +891,26 @@ void CppGenerator::writeMetaObjectMethod(QTextStream& s, const AbstractMetaClass s << '}' << endl << endl; // qt_metacall function - s << "int " << wrapperClassName << "::qt_metacall(QMetaObject::Call call, int id, void** args)\n"; - s << "{\n"; - s << INDENT << "int result = " << metaClass->qualifiedCppName() << "::qt_metacall(call, id, args);\n"; - s << INDENT << "return result < 0 ? result : PySide::SignalManager::qt_metacall(this, call, id, args);\n"; - s << "}\n\n"; + s << "int " << wrapperClassName << "::qt_metacall(QMetaObject::Call call, int id, void** args)" << endl; + s << "{" << endl; + + AbstractMetaFunction *func = NULL; + AbstractMetaFunctionList list = metaClass->queryFunctionsByName("qt_metacall"); + if (list.size() == 1) + func = list[0]; + + CodeSnipList snips; + if (func) { + snips = func->injectedCodeSnips(); + if (func->isUserAdded()) { + CodeSnipList snips = func->injectedCodeSnips(); + writeCodeSnips(s, snips, CodeSnip::Any, TypeSystem::NativeCode, func); + } + } + + s << INDENT << "int result = " << metaClass->qualifiedCppName() << "::qt_metacall(call, id, args);" << endl; + s << INDENT << "return result < 0 ? result : PySide::SignalManager::qt_metacall(this, call, id, args);" << endl; + s << "}" << endl << endl; // qt_metacast function writeMetaCast(s, metaClass); @@ -1844,7 +1860,6 @@ void CppGenerator::writeFunctionCalls(QTextStream& s, const OverloadData& overlo void CppGenerator::writeSingleFunctionCall(QTextStream& s, const OverloadData& overloadData, const AbstractMetaFunction* func) { if (func->isDeprecated()) { - qDebug() << "DEPRECATED FUNCTION:" << func->signature(); s << INDENT << "Shiboken::warning(PyExc_DeprecationWarning, 1, \"Function: '" << func->signature().replace("::", ".") << "' is marked as deprecated, please check the documentation for more information.\");" << endl; |