diff options
author | Casper van Donderen <casper.vandonderen@nokia.com> | 2012-06-28 12:49:06 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-28 14:44:20 +0200 |
commit | 50dfd15dcc49d12c5335a37999aef041d7fdfaae (patch) | |
tree | dab16f7ffbfac39a431cc8e547cde94e7766cc9e /src/tools | |
parent | d359b0af2b93aeb9c22714be1cec881417650ed8 (diff) |
QDoc: Allow '0' to be used as 2nd arg for \qmlclass.
There can be occurences of \qmlclass where there is no C++ class (for a
pure QML Type for example). QDoc will ignore searching for a C++ class
when '0' is specified as second argument to the \qmlclass command.
Change-Id: I09c8c7ad302daffb0723a49967951ca623e646e4
Reviewed-by: Martin Smith <martin.smith@nokia.com>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/qdoc/cppcodeparser.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp index f1a01e72f1..5fcbc3e365 100644 --- a/src/tools/qdoc/cppcodeparser.cpp +++ b/src/tools/qdoc/cppcodeparser.cpp @@ -728,8 +728,17 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, else if (command == COMMAND_QMLCLASS) { ClassNode* classNode = 0; QStringList names = arg.first.split(QLatin1Char(' ')); - if (names.size() > 1) - classNode = tree_->findClassNode(names[1].split("::")); + bool ignoreCppClass = false; + if (names.size() > 1) { + /* + If the second argument of the \\qmlclass command is 0 we should ignore the C++ class. + The second argument should only be 0 when you are documenting QML in a .qdoc file. + */ + if (names[1] != "0") + classNode = tree_->findClassNode(names[1].split("::")); + else + ignoreCppClass = true; + } /* Search for a node with the same name. If there is one, @@ -746,17 +755,18 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, QmlClassNode* qcn = new QmlClassNode(tree_->root(), names[0], classNode); qcn->setLocation(doc.startLocation()); if (isParsingCpp() || isParsingQdoc()) { - qcn->requireCppClass(); - if (names.size() < 2) { - QString msg = "C++ class name not specified for class documented as " - "QML type: '\\qmlclass " + arg.first + " <class name>'"; - doc.startLocation().warning(tr(msg.toLatin1().data())); - } - else if (!classNode) { - QString msg = "C++ class not found in any .h file for class documented " + QString msg; + if (names.size() < 2) + msg = "C++ class name not specified for class documented as " + "QML type: '\\qmlclass " + arg.first + " <class name>'." + " '0' should be used as second argument if there is no C++ class."; + else if (!classNode && !ignoreCppClass) + msg = "C++ class not found in any .h file for class documented " "as QML type: '\\qmlclass " + arg.first + "'"; + else if (!ignoreCppClass) + qcn->requireCppClass(); + if (!msg.isEmpty()) doc.startLocation().warning(tr(msg.toLatin1().data())); - } } if (ncn) ncn->addCollision(qcn); |