diff options
author | Topi Reinio <topi.reinio@qt.io> | 2020-04-21 23:57:46 +0200 |
---|---|---|
committer | Topi Reinio <topi.reinio@qt.io> | 2020-04-23 10:19:54 +0200 |
commit | e967772fe884dd8a488a359c122c9cbae9d94c55 (patch) | |
tree | 570c6bb5f46ef5409f4508a746dbde4542f7d7a9 /src/qdoc/tree.cpp | |
parent | 95cd9078938bcd88fdfbba707911e8111f59f195 (diff) |
qdoc: properly implement \typealias command
\typealias was already a command recognized by QDoc, but it was simply
treated as a synonym for \typedef and was not documented. Implement
proper support for the command:
- Add [alias] designation both in type summary and details.
- Auto-generate information about the aliased type, including a link
if aliasing a public, documented type.
- Auto-convert aliases documented with \typedef to type aliases.
- Add basic support for aliases also to DocBook and WebXML generators.
- Document \typealias.
Fixes: QTBUG-82712
Change-Id: Iafa8c7def0a7488d7521fbc2862290a9bb3167ff
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/qdoc/tree.cpp')
-rw-r--r-- | src/qdoc/tree.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/qdoc/tree.cpp b/src/qdoc/tree.cpp index f6477b6b1..e20b8cc65 100644 --- a/src/qdoc/tree.cpp +++ b/src/qdoc/tree.cpp @@ -355,11 +355,14 @@ void Tree::resolveCppToQmlLinks() /*! For each C++ class node, resolve any \c using clauses that appeared in the class declaration. + + For type aliases, resolve the aliased node. */ -void Tree::resolveUsingClauses() +void Tree::resolveUsingClauses(Aggregate *parent) { - const NodeList &children = root_.childNodes(); - for (auto *child : children) { + if (!parent) + parent = &root_; + for (auto *child : parent->childNodes()) { if (child->isClassNode()) { ClassNode *cn = static_cast<ClassNode *>(child); QVector<UsingClause> &usingClauses = cn->usingClauses(); @@ -370,7 +373,13 @@ void Tree::resolveUsingClauses() usingClause.setNode(n); } } + } else if (child->isTypeAlias()) { + TypeAliasNode *ta = static_cast<TypeAliasNode *>(child); + ta->setAliasedNode(qdb_->findNodeForTarget(ta->aliasedType(), child->parent())); } + + if (child->genus() == Node::CPP && child->isAggregate()) + resolveUsingClauses(static_cast<Aggregate *>(child)); } } |