Skip to content

Commit dabafef

Browse files
author
David Boddie
committed
QDoc: Read associated enum information for typedefs from index files
This fixes cross-module linking to flags by reading in the associated enum information that is present in index files. The HTML generator uses the presence of an associated enum to insert the word "flags" in appropriate places in the documentation. Task-number: QTBUG-139193 Change-Id: Ie7329a36d17e7e3ae023e0bbe7fdbae0d8c18fd6 Reviewed-by: Paul Wicking <[email protected]>
1 parent f3b238d commit dabafef

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/qdoc/qdoc/src/qdoc/qdocindexfiles.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,10 +395,22 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current,
395395

396396
hasReadChildren = true;
397397
} else if (elementName == QLatin1String("typedef")) {
398+
TypedefNode *typedefNode;
398399
if (attributes.hasAttribute("aliasedtype"))
399-
node = new TypeAliasNode(parent, name, attributes.value(QLatin1String("aliasedtype")).toString());
400+
typedefNode = new TypeAliasNode(parent, name, attributes.value(QLatin1String("aliasedtype")).toString());
400401
else
401-
node = new TypedefNode(parent, name);
402+
typedefNode = new TypedefNode(parent, name);
403+
404+
// Associate the typedef with an enum, if specified.
405+
if (attributes.hasAttribute("enum")) {
406+
auto path = attributes.value(QLatin1String("enum")).toString();
407+
const Node *enode = m_qdb->findNodeForTarget(path, typedefNode);
408+
if (enode && enode->isEnumType()) {
409+
const EnumNode *n = static_cast<const EnumNode *>(enode);
410+
const_cast<EnumNode *>(n)->setFlagsType(typedefNode);
411+
}
412+
}
413+
node = typedefNode;
402414

403415
if (!indexUrl.isEmpty())
404416
location = Location(indexUrl + QLatin1Char('/') + parent->name().toLower() + ".html");

0 commit comments

Comments
 (0)