diff options
author | Topi Reinio <topi.reinio@qt.io> | 2020-11-16 10:57:35 +0100 |
---|---|---|
committer | Topi Reinio <topi.reinio@qt.io> | 2020-11-16 12:44:11 +0100 |
commit | 81186aef4acb54e30b8b3fed3dfd022c0c040737 (patch) | |
tree | 5309f12dd60eaf1282247f1a750d5cdef00d84fa | |
parent | f58c728685a6f4b9872467fea156160e20a40221 (diff) | |
download | qttools-81186aef4acb54e30b8b3fed3dfd022c0c040737.tar.gz |
qdoc: Allow \generatelist to list collections with no members
It's allowed for a collection node (e.g. a QML module page) to have
no members (QML types), and still be considered valid. List these
types of pages when processing the \generatelist command.
Fixes: QTBUG-88536
Change-Id: I23c890c4752039f29489a7504f73f8078fe01fe3
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
6 files changed, 74 insertions, 7 deletions
diff --git a/src/qdoc/qdocdatabase.cpp b/src/qdoc/qdocdatabase.cpp index 9fd4038b1..9df6532d7 100644 --- a/src/qdoc/qdocdatabase.cpp +++ b/src/qdoc/qdocdatabase.cpp @@ -1472,13 +1472,11 @@ void QDocDatabase::mergeCollections(Node::NodeType type, CNMap &cnm, const Node } } } - if (!n->members().isEmpty()) { - QString sortKey = n->fullTitle().toLower(); - if (sortKey.startsWith("the ")) - sortKey.remove(0, 4); - sortKey.replace(singleDigit, "0\\1"); - cnm.insert(sortKey, n); - } + QString sortKey = n->fullTitle().toLower(); + if (sortKey.startsWith("the ")) + sortKey.remove(0, 4); + sortKey.replace(singleDigit, "0\\1"); + cnm.insert(sortKey, n); } } } diff --git a/tests/auto/qdoc/generatedoutput/expected_output/qmlmodules.html b/tests/auto/qdoc/generatedoutput/expected_output/qmlmodules.html new file mode 100644 index 000000000..befdc8924 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/expected_output/qmlmodules.html @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<!-- modules.qdoc --> + <title>QML Modules | Test</title> +</head> +<body> +<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div> +<h1 class="title">QML Modules</h1> +<span class="subtitle"></span> +<!-- $$$qmlmodules.html-description --> +<div class="descr"> <a name="details"></a> +<div class="table"><table class="annotated"> +<tr class="odd topAlign"><td class="tblName"><p><a href="test-empty-qmlmodule.html">No QML Types Here</a></p></td><td class="tblDescr"><p>A QML module with no member types.</p></td></tr> +<tr class="even topAlign"><td class="tblName"><p><a href="qdoc-test-qmlmodule.html">QDoc.Test</a></p></td><td class="tblDescr"><p>QML Types for the Test module.</p></td></tr> +<tr class="odd topAlign"><td class="tblName"><p><a href="uicomponents-qmlmodule.html">UI Components</a></p></td><td class="tblDescr"><p>Basic set of UI components.</p></td></tr> +</table></div> +</div> +<!-- @@@qmlmodules.html --> +</body> +</html> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/test.qhp b/tests/auto/qdoc/generatedoutput/expected_output/test.qhp index 957be6bf0..9bd9cd5ad 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/test.qhp +++ b/tests/auto/qdoc/generatedoutput/expected_output/test.qhp @@ -11,8 +11,10 @@ <section ref="test-cmaketest-example.html" title="CMake Example Project"/> <section ref="test-demos-demo-example.html" title="Demo"/> <section ref="test-demos-hidden-example.html" title="Hidden Demo"/> + <section ref="test-empty-qmlmodule.html" title="No QML Types Here"/> <section ref="testcpp-module.html" title="QDoc Test C++ Classes"/> <section ref="test-componentset-example.html" title="QML Documentation Example"/> + <section ref="qmlmodules.html" title="QML Modules"/> <section ref="uicomponents-qmlmodule.html" title="UI Components"/> </section> <section ref="testcpp-module.html" title="Classes"> @@ -61,11 +63,13 @@ <keyword name="Child" id="QML.QDoc.Test1.Child" ref="qml-qdoc-test-child.html"/> <keyword name="DocTest" id="QML.DocTest" ref="qml-qdoc-test-doctest.html"/> <keyword name="DocTest" id="QML.QDoc.Test1.DocTest" ref="qml-qdoc-test-doctest.html"/> + <keyword name="No QML Types Here" id="No QML Types Here" ref="test-empty-qmlmodule.html"/> <keyword name="ProgressBar" id="QML.ProgressBar" ref="qml-uicomponents-progressbar.html"/> <keyword name="ProgressBar" id="QML.UIComponents1.ProgressBar" ref="qml-uicomponents-progressbar.html"/> <keyword name="QDOCTEST_MACRO" id="QDOCTEST_MACRO" ref="testqdoc.html#QDOCTEST_MACRO"/> <keyword name="QDOCTEST_MACRO2" id="QDOCTEST_MACRO2" ref="testqdoc-test.html#QDOCTEST_MACRO2"/> <keyword name="QDoc Test C++ Classes" id="QDoc Test C++ Classes" ref="testcpp-module.html"/> + <keyword name="QML Modules" id="QML Modules" ref="qmlmodules.html"/> <keyword name="Switch" id="QML.Switch" ref="qml-uicomponents-switch.html"/> <keyword name="Switch" id="QML.UIComponents1.Switch" ref="qml-uicomponents-switch.html"/> <keyword name="TabWidget" id="QML.TabWidget" ref="qml-uicomponents-tabwidget.html"/> @@ -146,6 +150,7 @@ <file>qml-uicomponents-switch.html</file> <file>qml-uicomponents-tabwidget-members.html</file> <file>qml-uicomponents-tabwidget.html</file> + <file>qmlmodules.html</file> <file>test-cmaketest-cmakelists-txt.html</file> <file>test-cmaketest-example.html</file> <file>test-cmaketest-main-cpp.html</file> @@ -157,6 +162,7 @@ <file>test-componentset-tabwidget-qml.html</file> <file>test-demos-demo-example.html</file> <file>test-demos-hidden-example.html</file> + <file>test-empty-qmlmodule.html</file> <file>testcpp-module.html</file> <file>testqdoc-test-members.html</file> <file>testqdoc-test-obsolete.html</file> diff --git a/tests/auto/qdoc/generatedoutput/testdata/qml/modules.qdoc b/tests/auto/qdoc/generatedoutput/testdata/qml/modules.qdoc new file mode 100644 index 000000000..12db2a0c1 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/testdata/qml/modules.qdoc @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qmlmodules.html + \title QML Modules + + \generatelist qml-modules +*/ diff --git a/tests/auto/qdoc/generatedoutput/testdata/qml/type.cpp b/tests/auto/qdoc/generatedoutput/testdata/qml/type.cpp index 439738342..31f027ff0 100644 --- a/tests/auto/qdoc/generatedoutput/testdata/qml/type.cpp +++ b/tests/auto/qdoc/generatedoutput/testdata/qml/type.cpp @@ -38,6 +38,12 @@ */ /*! + \qmlmodule Test.Empty 1.0 + \title No QML Types Here + \brief A QML module with no member types. +*/ + +/*! \qmltype Type \instantiates TestQDoc::Test \inqmlmodule QDoc.Test diff --git a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp index 15fc5f7f6..2bc078d44 100644 --- a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp +++ b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp @@ -243,6 +243,7 @@ void tst_generatedOutput::htmlFromCpp() void tst_generatedOutput::htmlFromQml() { testAndCompare("testdata/configs/testqml.qdocconf", + "qmlmodules.html " "test-componentset-example.html " "test-cmaketest-example.html " "uicomponents-qmlmodule.html " |