diff options
author | David Boddie <david.boddie@qt.io> | 2025-08-14 17:38:41 +0200 |
---|---|---|
committer | David Boddie <david.boddie@qt.io> | 2025-08-26 16:12:02 +0200 |
commit | dabafef01eb410880e1695af74e2fb0c84ee6095 (patch) | |
tree | 196328454cd8c65afdc429d75c0ce13ea732e91c | |
parent | f3b238d2e0f584e0de5378b8e8890b332bb8fdb6 (diff) |
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 <paul.wicking@qt.io>
-rw-r--r-- | src/qdoc/qdoc/src/qdoc/qdocindexfiles.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/qdoc/qdoc/src/qdoc/qdocindexfiles.cpp b/src/qdoc/qdoc/src/qdoc/qdocindexfiles.cpp index 432a13add..ceaf4b928 100644 --- a/src/qdoc/qdoc/src/qdoc/qdocindexfiles.cpp +++ b/src/qdoc/qdoc/src/qdoc/qdocindexfiles.cpp @@ -395,10 +395,22 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current, hasReadChildren = true; } else if (elementName == QLatin1String("typedef")) { + TypedefNode *typedefNode; if (attributes.hasAttribute("aliasedtype")) - node = new TypeAliasNode(parent, name, attributes.value(QLatin1String("aliasedtype")).toString()); + typedefNode = new TypeAliasNode(parent, name, attributes.value(QLatin1String("aliasedtype")).toString()); else - node = new TypedefNode(parent, name); + typedefNode = new TypedefNode(parent, name); + + // Associate the typedef with an enum, if specified. + if (attributes.hasAttribute("enum")) { + auto path = attributes.value(QLatin1String("enum")).toString(); + const Node *enode = m_qdb->findNodeForTarget(path, typedefNode); + if (enode && enode->isEnumType()) { + const EnumNode *n = static_cast<const EnumNode *>(enode); + const_cast<EnumNode *>(n)->setFlagsType(typedefNode); + } + } + node = typedefNode; if (!indexUrl.isEmpty()) location = Location(indexUrl + QLatin1Char('/') + parent->name().toLower() + ".html"); |