qdoc: Handle collision nodes when building index files

Currently qdoc skips collision nodes (and their children)
when reading index files. This means that cross-linking
between modules does not work for nodes that are defined
under a collision page node. Most notably, the QML global
object 'Qt' cannot be linked to from outside Qml module
as it collides with Qt namespace.

This change fixes the issue by skipping collision nodes
and only processing their children when writing index
files. In addition, we need to adjust the function that
searches for nodes to the possibility that there may be
multiple nodes with the same name but different type.

Task-number: QTBUG-31096
Change-Id: Ic71d714f85539d8537021c73d8f1a527006a6f23
Reviewed-by: Martin Smith <martin.smith@digia.com>
This commit is contained in:
Topi Reinio 2013-05-28 13:47:32 +02:00 committed by The Qt Project
parent c3bec846ac
commit 389b6f5161
2 changed files with 12 additions and 4 deletions

View File

@ -862,9 +862,12 @@ Node* InnerNode::findChildNodeByNameAndType(const QString& name, Type type)
if (type == Function)
return primaryFunctionMap.value(name);
else {
Node *node = childMap.value(name);
if (node && node->type() == type)
return node;
QList<Node*> nodes = childMap.values(name);
for (int i=0; i<nodes.size(); ++i) {
Node* node = nodes.at(i);
if (node->type() == type)
return node;
}
}
return 0;
}

View File

@ -1183,8 +1183,13 @@ void QDocIndexFiles::generateIndexSections(QXmlStreamWriter& writer,
It is just a place holder for a collection of QML property
nodes. Recurse to its children, which are the QML property
nodes.
Do the same thing for collision nodes - we want children
of collision nodes in the index, but leaving out the
parent collision page will make searching for nodes easier.
*/
if (child->subType() == Node::QmlPropertyGroup) {
if (child->subType() == Node::QmlPropertyGroup ||
child->subType() == Node::Collision) {
const InnerNode* pgn = static_cast<const InnerNode*>(child);
foreach (Node* c, pgn->childNodes()) {
generateIndexSections(writer, c, generateInternalNodes);