From e8bfcf7696af6bc4811ce2d66c4f199579f3456c Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Thu, 4 Jun 2020 20:48:09 +0200 Subject: qdoc: DocBook generator: Fix \headerfile generation Header files were missing content when using the DocBook output format. Fixes: QTBUG-84224 Change-Id: I625ff2a4b14d69f6df0f706cfd4fdbef2cd7fd7f Reviewed-by: Paul Wicking (cherry picked from commit 3297d012680e083b25a4740229f9fe77c4fdbc17) Reviewed-by: Qt Cherry-pick Bot --- src/qdoc/docbookgenerator.cpp | 10 ++-- .../headerfile-docbook/testheader.xml | 70 +++++++++++++++++++++- 2 files changed, 75 insertions(+), 5 deletions(-) diff --git a/src/qdoc/docbookgenerator.cpp b/src/qdoc/docbookgenerator.cpp index 3e4f03cf0..82893be97 100644 --- a/src/qdoc/docbookgenerator.cpp +++ b/src/qdoc/docbookgenerator.cpp @@ -2436,12 +2436,10 @@ void DocBookGenerator::generateCppReferencePage(Node *node) QString title; QString rawTitle; QString fullTitle; - const NamespaceNode *ns = nullptr; if (aggregate->isNamespace()) { rawTitle = aggregate->plainName(); fullTitle = aggregate->plainFullName(); title = rawTitle + " Namespace"; - ns = static_cast(aggregate); } else if (aggregate->isClass()) { rawTitle = aggregate->plainName(); QString templateDecl = node->templateDecl(); @@ -2449,6 +2447,8 @@ void DocBookGenerator::generateCppReferencePage(Node *node) fullTitle = QString("%1 %2 ").arg(templateDecl, aggregate->typeWord(false)); fullTitle += aggregate->plainFullName(); title = rawTitle + QLatin1Char(' ') + aggregate->typeWord(true); + } else if (aggregate->isHeader()) { + title = fullTitle = rawTitle = aggregate->fullTitle(); } QString subtitleText; @@ -2479,8 +2479,10 @@ void DocBookGenerator::generateCppReferencePage(Node *node) } Sections sections(const_cast(aggregate)); - SectionVector *sectionVector = - ns ? §ions.stdDetailsSections() : §ions.stdCppClassDetailsSections(); + auto *sectionVector = + (aggregate->isNamespace() || aggregate->isHeader()) ? + §ions.stdDetailsSections() : + §ions.stdCppClassDetailsSections(); SectionVector::ConstIterator section = sectionVector->constBegin(); while (section != sectionVector->constEnd()) { bool headerGenerated = false; diff --git a/tests/auto/qdoc/generatedoutput/expected_output/headerfile-docbook/testheader.xml b/tests/auto/qdoc/generatedoutput/expected_output/headerfile-docbook/testheader.xml index f3461fb1a..afa0b20a3 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/headerfile-docbook/testheader.xml +++ b/tests/auto/qdoc/generatedoutput/expected_output/headerfile-docbook/testheader.xml @@ -1,7 +1,7 @@ - +<TestHeader> - Test Header HeaderFile HeaderFile Reference Documentation @@ -19,4 +19,72 @@ Detailed Description + +Type Documentation + +enum Globals + +Globals +public +active +unspecified +HeaderFile + + + + + + +Constant +Description + + + + +Glo + +0 + + + +Bal + +1 + + + + + +Variable Documentation + +const int globalVar + +const int +globalVar +public +active +unspecified +HeaderFile + +Global variable. + + + +Function Documentation + +void globalFunc() + + +globalFunc + +plain +void globalFunc() +public +active +unspecified +HeaderFile + +Global function. + + -- cgit v1.2.3