diff options
-rw-r--r-- | src/qdoc/generator.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp index 5ec9e4c58..bef912013 100644 --- a/src/qdoc/generator.cpp +++ b/src/qdoc/generator.cpp @@ -1632,10 +1632,11 @@ void Generator::generateOverloadedSignal(const Node* node, CodeMarker* marker) objectName[0] = objectName[0].toLower(); } - - // We have an overloaded signal, show an example - QString code = "connect(" + objectName + ", static_cast<" + func->returnType() - + QLatin1Char('(') + func->parent()->name() + "::*)("; + // We have an overloaded signal, show an example. Note, for const + // overloaded signals one should use Q{Const,NonConst}Overload, but + // it is very unlikely that we will ever have public API overloading + // signals by const. + QString code = "connect(" + objectName + ", QOverload<"; for (int i = 0; i < func->parameters().size(); ++i) { if (i != 0) code += ", "; @@ -1643,10 +1644,7 @@ void Generator::generateOverloadedSignal(const Node* node, CodeMarker* marker) code += p.dataType() + p.rightType(); } - code += QLatin1Char(')'); - if (func->isConst()) - code += " const"; - code += ">(&" + func->parent()->name() + "::" + func->name() + "),\n [=]("; + code += ">::of(&" + func->parent()->name() + "::" + func->name() + "),\n [=]("; for (int i = 0; i < func->parameters().size(); ++i) { if (i != 0) @@ -1670,8 +1668,9 @@ void Generator::generateOverloadedSignal(const Node* node, CodeMarker* marker) << node->name() << Atom(Atom::FormattingRight,ATOM_FORMATTING_ITALIC) << " is overloaded in this class. " - "To connect to this one using the function pointer syntax, you must " - "specify the signal type in a static cast, as shown in this example:" + "To connect to this signal by using the function pointer syntax, Qt " + "provides a convenient helper for obtaining the function pointer as " + "shown in this example:" << Atom(Atom::Code, marker->markedUpCode(code, node, func->location())); generateText(text, node, marker); |