summaryrefslogtreecommitdiffstats
path: root/src/qdoc/qdocindexfiles.cpp
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2020-04-21 23:57:46 +0200
committerTopi Reinio <topi.reinio@qt.io>2020-04-23 10:19:54 +0200
commite967772fe884dd8a488a359c122c9cbae9d94c55 (patch)
tree570c6bb5f46ef5409f4508a746dbde4542f7d7a9 /src/qdoc/qdocindexfiles.cpp
parent95cd9078938bcd88fdfbba707911e8111f59f195 (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/qdocindexfiles.cpp')
-rw-r--r--src/qdoc/qdocindexfiles.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qdoc/qdocindexfiles.cpp b/src/qdoc/qdocindexfiles.cpp
index 60cace3c9..d2768803d 100644
--- a/src/qdoc/qdocindexfiles.cpp
+++ b/src/qdoc/qdocindexfiles.cpp
@@ -454,6 +454,13 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader &reader, Node *current,
else if (!indexUrl.isNull())
location = Location(parent->name().toLower() + ".html");
+ } else if (elementName == QLatin1String("alias")) {
+ node = new TypeAliasNode(parent, name, attributes.value(QLatin1String("aliasedtype")).toString());
+ if (!indexUrl.isEmpty())
+ location = Location(indexUrl + QLatin1Char('/') + parent->name().toLower() + ".html");
+ else if (!indexUrl.isNull())
+ location = Location(parent->name().toLower() + ".html");
+
} else if (elementName == QLatin1String("property")) {
node = new PropertyNode(parent, name);
@@ -864,6 +871,9 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
case Node::Typedef:
nodeName = "typedef";
break;
+ case Node::TypeAlias:
+ nodeName = "alias";
+ break;
case Node::Property:
nodeName = "property";
break;
@@ -1196,6 +1206,9 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node,
if (typedefNode->associatedEnum())
writer.writeAttribute("enum", typedefNode->associatedEnum()->fullDocumentName());
} break;
+ case Node::TypeAlias:
+ writer.writeAttribute("aliasedtype", static_cast<const TypeAliasNode *>(node)->aliasedType());
+ break;
case Node::Function: // Now processed in generateFunctionSection()
default:
break;