diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-02-08 03:03:47 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-02-08 03:03:48 +0100 |
commit | 70ee5bfa894b74f4af9f2f2e031828f9e3933b2b (patch) | |
tree | 74d1859159b98f71a5243e852e962070bb629862 | |
parent | e530515bf311460e3173ca411970336885891405 (diff) | |
parent | 08a55ca1e48f5be501446e618356b30c21ae8bd6 (diff) |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ib8c7aa10dc0aa93ec4572a10b0cd39d9686f0523
-rw-r--r-- | src/designer/src/lib/shared/qlayout_widget.cpp | 4 | ||||
-rw-r--r-- | src/linguist/shared/qm.cpp | 21 | ||||
-rw-r--r-- | src/qdoc/clangcodeparser.cpp | 5 | ||||
-rw-r--r-- | src/qdoc/docbookgenerator.h | 16 | ||||
-rw-r--r-- | src/qdoc/generator.cpp | 9 | ||||
-rw-r--r-- | tests/auto/qdoc/generatedoutput/crossmodule/CrossModule | 2 | ||||
-rw-r--r-- | tests/auto/qdoc/generatedoutput/crossmodule/crossmodule.qdocconf | 10 | ||||
-rw-r--r-- | tests/auto/qdoc/generatedoutput/crossmodule/testtype.cpp | 56 | ||||
-rw-r--r-- | tests/auto/qdoc/generatedoutput/crossmodule/testtype.h | 37 | ||||
-rw-r--r-- | tests/auto/qdoc/generatedoutput/expected_output/crossmodule/testtype-members.html | 23 | ||||
-rw-r--r-- | tests/auto/qdoc/generatedoutput/expected_output/crossmodule/testtype.html | 57 | ||||
-rw-r--r-- | tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp | 28 |
12 files changed, 253 insertions, 15 deletions
diff --git a/src/designer/src/lib/shared/qlayout_widget.cpp b/src/designer/src/lib/shared/qlayout_widget.cpp index 5e4de4bc1..647104cd9 100644 --- a/src/designer/src/lib/shared/qlayout_widget.cpp +++ b/src/designer/src/lib/shared/qlayout_widget.cpp @@ -1915,11 +1915,11 @@ void QLayoutWidget::paintEvent(QPaintEvent*) columns[column + i - 2] = true; while (rowSpan > 0) { - excludedColumnsForRow[row + rowSpan - 1].unite(columns); + excludedColumnsForRow[row + rowSpan - 1].insert(columns); rowSpan--; } while (columnSpan > 0) { - excludedRowsForColumn[column + columnSpan - 1].unite(rows); + excludedRowsForColumn[column + columnSpan - 1].insert(rows); columnSpan--; } } diff --git a/src/linguist/shared/qm.cpp b/src/linguist/shared/qm.cpp index 6963ad6cb..288607824 100644 --- a/src/linguist/shared/qm.cpp +++ b/src/linguist/shared/qm.cpp @@ -151,9 +151,9 @@ public: uint o; }; - enum { Contexts = 0x2f, Hashes = 0x42, Messages = 0x69, NumerusRules = 0x88, Dependencies = 0x96 }; + enum { Contexts = 0x2f, Hashes = 0x42, Messages = 0x69, NumerusRules = 0x88, Dependencies = 0x96, Language = 0xa7 }; - Releaser() {} + Releaser(const QString &language) : m_language(language) {} bool save(QIODevice *iod); @@ -179,6 +179,7 @@ private: void writeMessage(const ByteTranslatorMessage & msg, QDataStream & stream, TranslatorSaveMode strip, Prefix prefix) const; + QString m_language; // for squeezed but non-file data, this is what needs to be deleted QByteArray m_messageArray; QByteArray m_offsetArray; @@ -249,6 +250,12 @@ bool Releaser::save(QIODevice *iod) QDataStream s(iod); s.writeRawData((const char *)magic, MagicLength); + if (!m_language.isEmpty()) { + QByteArray lang = originalBytes(m_language); + quint32 las = quint32(lang.size()); + s << quint8(Language) << las; + s.writeRawData(lang, las); + } if (!m_dependencyArray.isEmpty()) { quint32 das = quint32(m_dependencyArray.size()); s << quint8(Dependencies) << das; @@ -465,7 +472,7 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) return false; } - enum { Contexts = 0x2f, Hashes = 0x42, Messages = 0x69, NumerusRules = 0x88, Dependencies = 0x96 }; + enum { Contexts = 0x2f, Hashes = 0x42, Messages = 0x69, NumerusRules = 0x88, Dependencies = 0x96, Language = 0xa7 }; // for squeezed but non-file data, this is what needs to be deleted const uchar *messageArray = 0; @@ -473,6 +480,7 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) uint offsetLength = 0; bool ok = true; + bool utf8Fail = false; const uchar *end = data + len; data += MagicLength; @@ -505,6 +513,10 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) dependencies.append(dep); } translator.setDependencies(dependencies); + } else if (tag == Language) { + QString language; + fromBytes((const char *)data, blockLen, &language, &utf8Fail); + translator.setLanguageCode(language); } data += blockLen; @@ -524,7 +536,6 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) guessPlurals = (numerusForms.count() == 1); QString context, sourcetext, comment; - bool utf8Fail = false; QStringList translations; for (const uchar *start = offsetArray; start != offsetArray + (numItems << 3); start += 8) { @@ -632,7 +643,7 @@ static bool containsStripped(const Translator &translator, const TranslatorMessa bool saveQM(const Translator &translator, QIODevice &dev, ConversionData &cd) { - Releaser releaser; + Releaser releaser(translator.languageCode()); QLocale::Language l; QLocale::Country c; Translator::languageAndCountry(translator.languageCode(), &l, &c); diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp index 037005b65..6768c3a1a 100644 --- a/src/qdoc/clangcodeparser.cpp +++ b/src/qdoc/clangcodeparser.cpp @@ -689,8 +689,9 @@ CXChildVisitResult ClangVisitor::visitHeader(CXCursor cursor, CXSourceLocation l auto baseNode = findNodeForCursor(qdb_, baseCursor); auto classe = static_cast<ClassNode *>(parent_); if (baseNode == nullptr || !baseNode->isClassNode()) { - QString bcName = fromCXString(clang_getCursorSpelling(baseCursor)); - classe->addUnresolvedBaseClass(access, QStringList(bcName), bcName); + QString bcName = reconstructQualifiedPathForCursor(baseCursor); + classe->addUnresolvedBaseClass(access, + bcName.split(QLatin1String("::"), QString::SkipEmptyParts), bcName); return CXChildVisit_Continue; } auto baseClasse = static_cast<ClassNode *>(baseNode); diff --git a/src/qdoc/docbookgenerator.h b/src/qdoc/docbookgenerator.h index 540aa7586..0c74a1708 100644 --- a/src/qdoc/docbookgenerator.h +++ b/src/qdoc/docbookgenerator.h @@ -56,12 +56,19 @@ public: protected: QString fileExtension() const override; void generateDocumentation(Node *node) override; + using Generator::generateCppReferencePage; void generateCppReferencePage(Node *node); + using Generator::generatePageNode; void generatePageNode(PageNode *pn); + using Generator::generateQmlTypePage; void generateQmlTypePage(QmlTypeNode *qcn); + using Generator::generateQmlBasicTypePage; void generateQmlBasicTypePage(QmlBasicTypeNode *qbtn); + using Generator::generateCollectionNode; void generateCollectionNode(CollectionNode *cn); + using Generator::generateGenericCollectionPage; void generateGenericCollectionPage(CollectionNode *cn); + using Generator::generateProxyPage; void generateProxyPage(Aggregate *aggregate); void generateList(QXmlStreamWriter &writer, const Node *relative, const QString &selector); @@ -78,11 +85,14 @@ protected: bool generateStatus(QXmlStreamWriter &writer, const Node *node); bool generateThreadSafeness(QXmlStreamWriter &writer, const Node *node); bool generateSince(QXmlStreamWriter &writer, const Node *node); + using Generator::generateBody; void generateBody(QXmlStreamWriter &writer, const Node *node); + using Generator::generateText; bool generateText(QXmlStreamWriter &writer, const Text &text, const Node *relative); const Atom *generateAtomList(QXmlStreamWriter &writer, const Atom *atom, const Node *relative, bool generate, int &numAtoms); + using Generator::generateAtom; int generateAtom(QXmlStreamWriter &writer, const Atom *atom, const Node *relative); private: @@ -100,6 +110,7 @@ private: void generateCompactList(QXmlStreamWriter &writer, ListType listType, const Node *relative, const NodeMultiMap &nmm, const QString &commonPrefix, const QString &selector); + using Generator::generateFileList; void generateFileList(QXmlStreamWriter &writer, const ExampleNode *en, bool images); void generateObsoleteMembers(QXmlStreamWriter &writer, const Sections §ions); void generateObsoleteQmlMembers(QXmlStreamWriter &writer, const Sections §ions); @@ -123,18 +134,22 @@ private: void generateFullName(QXmlStreamWriter &writer, const Node *apparentNode, const QString &fullName, const Node *actualNode); void generateBrief(QXmlStreamWriter &writer, const Node *node); + using Generator::generateAlsoList; void generateAlsoList(QXmlStreamWriter &writer, const Node *node); static void generateSignatureList(QXmlStreamWriter &writer, const NodeList &nodes); + using Generator::generateMaintainerList; void generateMaintainerList(QXmlStreamWriter &writer, const Aggregate *node); void generateReimplementsClause(QXmlStreamWriter &writer, const FunctionNode *fn); void generateClassHierarchy(QXmlStreamWriter &writer, const Node *relative, NodeMap &classMap); void generateFunctionIndex(QXmlStreamWriter &writer, const Node *relative); void generateLegaleseList(QXmlStreamWriter &writer, const Node *relative); + using Generator::generateExampleFilePage; void generateExampleFilePage(const Node *en, const QString &file); static void generateOverloadedSignal(QXmlStreamWriter &writer, const Node *node); static void generatePrivateSignalNote(QXmlStreamWriter &writer); static void generateInvokableNote(QXmlStreamWriter &writer, const Node *node); void generateAssociatedPropertyNotes(QXmlStreamWriter &writer, const FunctionNode *fn); + using Generator::generateQmlText; bool generateQmlText(QXmlStreamWriter &writer, const Text &text, const Node *relative); void generateRequiredLinks(QXmlStreamWriter &writer, const Node *node); void generateLinkToExample(QXmlStreamWriter &writer, const ExampleNode *en, @@ -147,7 +162,6 @@ private: const Node *relative); void endLink(QXmlStreamWriter &writer); - bool hasQuotingInformation {}; bool inListItemLineOpen {}; bool inLink {}; int currentSectionLevel {}; diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp index f4a391cee..fa442994e 100644 --- a/src/qdoc/generator.cpp +++ b/src/qdoc/generator.cpp @@ -1260,8 +1260,11 @@ void Generator::generateReimplementsClause(const FunctionNode *fn, CodeMarker *m appendFullName(text, overrides->parent(), fullName, overrides); text << "." << Atom::ParaRight; generateText(text, fn, marker); - return; + } else { + fn->doc().location().warning(tr("Illegal \\reimp; no documented virtual function for %1") + .arg(overrides->plainSignature())); } + return; } const PropertyNode *sameName = cn->findOverriddenProperty(fn); if (sameName && sameName->hasDoc()) { @@ -1271,10 +1274,6 @@ void Generator::generateReimplementsClause(const FunctionNode *fn, CodeMarker *m appendFullName(text, sameName->parent(), fullName, sameName); text << "." << Atom::ParaRight; generateText(text, fn, marker); - } else { - fn->doc().location().warning( - tr("Illegal \\reimp; no documented virtual function for %1") - .arg(fn->plainSignature())); } } } diff --git a/tests/auto/qdoc/generatedoutput/crossmodule/CrossModule b/tests/auto/qdoc/generatedoutput/crossmodule/CrossModule new file mode 100644 index 000000000..df9c82ad5 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/crossmodule/CrossModule @@ -0,0 +1,2 @@ +#include "../TestCPP" +#include "testtype.h" diff --git a/tests/auto/qdoc/generatedoutput/crossmodule/crossmodule.qdocconf b/tests/auto/qdoc/generatedoutput/crossmodule/crossmodule.qdocconf new file mode 100644 index 000000000..fb4a6be77 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/crossmodule/crossmodule.qdocconf @@ -0,0 +1,10 @@ +project = CrossModule +includepaths += -I. + +depends = testcpp + +headers = testtype.h +sources = testtype.cpp + +HTML.nosubdirs = true +HTML.outputsubdir = crossmodule diff --git a/tests/auto/qdoc/generatedoutput/crossmodule/testtype.cpp b/tests/auto/qdoc/generatedoutput/crossmodule/testtype.cpp new file mode 100644 index 000000000..50d5d4845 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/crossmodule/testtype.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +#include "testtype.h" + +/*! + \module CrossModule +*/ +/*! + \class TestType + \inmodule CrossModule + \brief A class inheriting another class that lives in an external doc + module. + + \section1 Linking + + These links go to the parent class: + \list + \li \l {TestQDoc::TestDerived} + \li \l {TestQDoc::}{Test} class \l Usage. + \li QDOCTEST_MACRO + \endlist + + \sa {TestQDoc::Test::}{someFunction()} +*/ + +/*! + Nothing to see here. +*/ +void TestType::nothing() +{ +} diff --git a/tests/auto/qdoc/generatedoutput/crossmodule/testtype.h b/tests/auto/qdoc/generatedoutput/crossmodule/testtype.h new file mode 100644 index 000000000..957505fcc --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/crossmodule/testtype.h @@ -0,0 +1,37 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +#pragma once + +#include "../testcpp.h" + +class TestType : public TestQDoc::TestDerived +{ +public: + TestType() {} + void nothing() {} +}; diff --git a/tests/auto/qdoc/generatedoutput/expected_output/crossmodule/testtype-members.html b/tests/auto/qdoc/generatedoutput/expected_output/crossmodule/testtype-members.html new file mode 100644 index 000000000..21870bb3f --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/expected_output/crossmodule/testtype-members.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<!-- testtype.cpp --> + <title>List of All Members for TestType | CrossModule</title> +</head> +<body> +<li>TestType</li> +<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div> +<h1 class="title">List of All Members for TestType</h1> +<p>This is the complete list of members for <a href="testtype.html">TestType</a>, including inherited members.</p> +<ul> +<li class="fn"><span class="name"><b><a href="testqdoc-test.html#inlineFunction">inlineFunction</a></b></span>()</li> +<li class="fn"><span class="name"><b><a href="testtype.html#nothing">nothing</a></b></span>()</li> +<li class="fn"><span class="name"><b><a href="testqdoc-test.html#overload">overload</a></b></span>()</li> +<li class="fn"><span class="name"><b><a href="testqdoc-test.html#overload-1">overload</a></b></span>(bool )</li> +<li class="fn"><span class="name"><b><a href="testqdoc-test.html#someFunction">someFunction</a></b></span>(int ) : int</li> +<li class="fn"><span class="name"><b><a href="testqdoc-test.html#someFunctionDefaultArg">someFunctionDefaultArg</a></b></span>(int , bool )</li> +<li class="fn"><span class="name"><b><a href="testqdoc-testderived.html#virtualFun">virtualFun</a></b></span>()</li> +</ul> +</body> +</html> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/crossmodule/testtype.html b/tests/auto/qdoc/generatedoutput/expected_output/crossmodule/testtype.html new file mode 100644 index 000000000..dcf2114b7 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/expected_output/crossmodule/testtype.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<!-- testtype.cpp --> + <title>TestType Class | CrossModule</title> +</head> +<body> +<li>TestType</li> +<div class="sidebar"> +<div class="toc"> +<h3><a name="toc">Contents</a></h3> +<ul> +<li class="level1"><a href="#public-functions">Public Functions</a></li> +<li class="level1"><a href="#details">Detailed Description</a></li> +<li class="level2"><a href="#linking">Linking</a></li> +</ul> +</div> +<div class="sidebar-content" id="sidebar-content"></div></div> +<h1 class="title">TestType Class</h1> +<!-- $$$TestType-brief --> +<p>A class inheriting another class that lives in an external doc module. <a href="#details">More...</a></p> +<!-- @@@TestType --> +<div class="table"><table class="alignedsummary"> +<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <TestType></span> +</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="testqdoc-testderived.html">TestQDoc::TestDerived</a></td></tr></table></div><ul> +<li><a href="testtype-members.html">List of all members, including inherited members</a></li> +</ul> +<a name="public-functions"></a> +<h2 id="public-functions">Public Functions</h2> +<div class="table"><table class="alignedsummary"> +<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="testtype.html#nothing">nothing</a></b>()</td></tr> +</table></div> +<a name="details"></a> +<!-- $$$TestType-description --> +<div class="descr"> +<h2 id="details">Detailed Description</h2> +<a name="linking"></a> +<h3 id="linking">Linking</h3> +<p>These links go to the parent class:</p> +<ul> +<li><a href="testqdoc-testderived.html">TestQDoc::TestDerived</a></li> +<li><a href="testqdoc-test.html">Test</a> class <a href="testqdoc.html#usage">Usage</a>.</li> +<li><a href="testqdoc.html#QDOCTEST_MACRO">QDOCTEST_MACRO</a></li> +</ul> +</div> +<p><b>See also </b><a href="testqdoc-test.html#someFunction">someFunction</a>().</p> +<!-- @@@TestType --> +<div class="func"> +<h2>Member Function Documentation</h2> +<!-- $$$nothing[overload1]$$$nothing --> +<h3 class="fn" id="nothing"><a name="nothing"></a><span class="type">void</span> TestType::<span class="name">nothing</span>()</h3> +<p>Nothing to see here.</p> +<!-- @@@nothing --> +</div> +</body> +</html> diff --git a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp index 3237bde26..f1c0b892e 100644 --- a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp +++ b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp @@ -27,6 +27,7 @@ ****************************************************************************/ #include <QProcess> #include <QTemporaryDir> +#include <QDirIterator> #include <QtTest> class tst_generatedOutput : public QObject @@ -61,6 +62,7 @@ private slots: void scopedEnum(); void dontDocument(); void inheritedQmlPropertyGroups(); + void crossModuleLinking(); private: QScopedPointer<QTemporaryDir> m_outputDir; @@ -70,6 +72,7 @@ private: void compareLineByLine(const QStringList &expectedFiles); void testAndCompare(const char *input, const char *outNames, const char *extraParams = nullptr, const char *outputPathPrefix = nullptr); + void copyIndexFiles(); }; void tst_generatedOutput::initTestCase() @@ -162,6 +165,20 @@ void tst_generatedOutput::testAndCompare(const char *input, const char *outNames compareLineByLine(expectedOuts); } +// Copy <project>.index to <project>/<project>.index in the outputdir +void tst_generatedOutput::copyIndexFiles() +{ + QDirIterator it(m_outputDir->path(), QStringList("*.index"), QDir::Files, QDirIterator::Subdirectories); + while (it.hasNext()) { + QFileInfo fileInfo(it.next()); + QDir indexDir(m_outputDir->path()); + QVERIFY(indexDir.mkpath(fileInfo.baseName())); + QVERIFY(indexDir.cd(fileInfo.baseName())); + if (!indexDir.exists(fileInfo.fileName())) + QVERIFY(QFile::copy(fileInfo.filePath(), indexDir.filePath(fileInfo.fileName()))); + } +} + void tst_generatedOutput::htmlFromQDocFile() { testAndCompare("test.qdocconf", @@ -306,6 +323,17 @@ void tst_generatedOutput::inheritedQmlPropertyGroups() "qmlpropertygroups/qml-qdoc-test-anotherchild-members.html"); } +void tst_generatedOutput::crossModuleLinking() +{ + htmlFromCpp(); + copyIndexFiles(); + QString indexDir = QLatin1String("-indexdir ") + m_outputDir->path(); + testAndCompare("crossmodule/crossmodule.qdocconf", + "crossmodule/testtype.html " + "crossmodule/testtype-members.html", + indexDir.toLatin1().data()); +} + QTEST_APPLESS_MAIN(tst_generatedOutput) #include "tst_generatedoutput.moc" |