summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-12-09 15:56:26 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-12-09 16:29:29 -0300
commit33537a0e9b0c3fc362032dec1820f08d248bed77 (patch)
tree6a9cdecd98b034b9aed98e420360ed0b374fa608
parent5b59c65a0f39198c4613400b9a49000b7d2315de (diff)
downloadshiboken-33537a0e9b0c3fc362032dec1820f08d248bed77.tar.gz
shiboken-33537a0e9b0c3fc362032dec1820f08d248bed77.tar.xz
shiboken-33537a0e9b0c3fc362032dec1820f08d248bed77.zip
Code generated for Qt's signals wrapping now deal with arguments with default values.
For instance, the "QAbstractButton::clicked(bool checked = false)" signal, can be connected using the two signatures "clicked()" and "clicked(bool)". Using button.clicked.connect(callback_function) could cause the binding to connect to "clicked(bool)", instead of "clicked()", leaving the user unaware of it. Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--generator/cppgenerator.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index b95d1cf2..0c99b09c 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -2991,6 +2991,13 @@ void CppGenerator::writeSignalInitialization(QTextStream& s, const AbstractMetaC
QString cppSignature = QMetaObject::normalizedType(qPrintable(type->cppSignature()));
QString originalSignature = QMetaObject::normalizedType(qPrintable(type->originalTypeDescription()));
+ if (!a->defaultValueExpression().isEmpty()) {
+ QString sig = QMetaObject::normalizedSignature(signature.toAscii());
+ if (sig.isEmpty())
+ sig = "void";
+ signatures[cppSignal->name()].append(sig);
+ }
+
if ((cppSignature != originalSignature) && !knowTypes.contains(originalSignature)) {
knowTypes << originalSignature;
s << INDENT << "Shiboken::TypeResolver::createValueTypeResolver<"