diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-04-22 10:12:13 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-04-22 10:12:14 +0200 |
commit | 95cd9078938bcd88fdfbba707911e8111f59f195 (patch) | |
tree | c55231a843255c0e8fa7d6c94fbf54bc1a9bb9a7 | |
parent | 1b992406a6523a144c58baa9bbd1198bb9a2d98c (diff) | |
parent | b3cdd63d4bdaea09222fb93ffcd5104a2dc0bf2e (diff) | |
download | qttools-95cd9078938bcd88fdfbba707911e8111f59f195.tar.gz |
Merge remote-tracking branch 'origin/5.15' into 5.15.0
Change-Id: I1fdd80c6b7c2615815acc262f01a3893d28406a3
31 files changed, 220 insertions, 136 deletions
diff --git a/dist/changes-5.14.2 b/dist/changes-5.14.2 new file mode 100644 index 000000000..f90f45318 --- /dev/null +++ b/dist/changes-5.14.2 @@ -0,0 +1,24 @@ +Qt 5.14.2 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.14.0 through 5.14.1. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.14 series is binary compatible with the 5.13.x series. +Applications compiled for 5.13 will continue to run with 5.14. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* qdoc * +**************************************************************************** + + - [QTBUG-82252] Fixed "-F" option on macOS diff --git a/src/assistant/assistant/helpviewer.h b/src/assistant/assistant/helpviewer.h index 667fa05a4..fa954cc9f 100644 --- a/src/assistant/assistant/helpviewer.h +++ b/src/assistant/assistant/helpviewer.h @@ -130,6 +130,7 @@ protected: void wheelEvent(QWheelEvent *event) override; void mousePressEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; + void resizeEvent(QResizeEvent *e) override; private slots: void actionChanged(); @@ -141,6 +142,7 @@ private: void contextMenuEvent(QContextMenuEvent *event) override; QVariant loadResource(int type, const QUrl &name) TEXTBROWSER_OVERRIDE; bool handleForwardBackwardMouseButtons(QMouseEvent *e); + void scrollToTextPosition(int position); private: HelpViewerPrivate *d; diff --git a/src/assistant/assistant/helpviewer_qtb.cpp b/src/assistant/assistant/helpviewer_qtb.cpp index f9bdddb52..260dbfc1d 100644 --- a/src/assistant/assistant/helpviewer_qtb.cpp +++ b/src/assistant/assistant/helpviewer_qtb.cpp @@ -38,6 +38,7 @@ #include <QtGui/QContextMenuEvent> #include <QtWidgets/QMenu> +#include <QtWidgets/QScrollBar> #ifndef QT_NO_CLIPBOARD #include <QtGui/QClipboard> #endif @@ -312,6 +313,14 @@ void HelpViewer::mouseReleaseEvent(QMouseEvent *e) QTextBrowser::mouseReleaseEvent(e); } + +void HelpViewer::resizeEvent(QResizeEvent *e) +{ + const int topTextPosition = cursorForPosition({width() / 2, 0}).position(); + QTextBrowser::resizeEvent(e); + scrollToTextPosition(topTextPosition); +} + // -- private slots void HelpViewer::actionChanged() @@ -377,4 +386,16 @@ QVariant HelpViewer::loadResource(int type, const QUrl &name) return ba; } + +void HelpViewer::scrollToTextPosition(int position) +{ + QTextCursor tc(document()); + tc.setPosition(position); + const int dy = cursorRect(tc).top(); + if (verticalScrollBar()) { + verticalScrollBar()->setValue( + std::min(verticalScrollBar()->value() + dy, verticalScrollBar()->maximum())); + } +} + QT_END_NAMESPACE diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp index 607dce880..a81a2f0d9 100644 --- a/src/macdeployqt/shared/shared.cpp +++ b/src/macdeployqt/shared/shared.cpp @@ -183,7 +183,7 @@ OtoolInfo findDependencyInfo(const QString &binaryPath) static const QRegularExpression regexp(QStringLiteral( "^\\t(.+) \\(compatibility version (\\d+\\.\\d+\\.\\d+), " - "current version (\\d+\\.\\d+\\.\\d+)\\)$")); + "current version (\\d+\\.\\d+\\.\\d+)(, weak)?\\)$")); QString output = otool.readAllStandardOutput(); QStringList outputLines = output.split("\n", Qt::SkipEmptyParts); diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp index db9c2ed07..b5c6a8ac6 100644 --- a/src/qdoc/clangcodeparser.cpp +++ b/src/qdoc/clangcodeparser.cpp @@ -65,6 +65,9 @@ QT_BEGIN_NAMESPACE static CXTranslationUnit_Flags flags_ = static_cast<CXTranslationUnit_Flags>(0); static CXIndex index_ = nullptr; +QByteArray ClangCodeParser::fn_; +constexpr const char *fnDummyFileName = "/fn_dummyfile.cpp"; + #ifndef QT_NO_DEBUG_STREAM template<class T> static QDebug operator<<(QDebug debug, const std::vector<T> &v) @@ -199,11 +202,15 @@ static QString getSpelling(CXSourceRange range) unsigned int offset1, offset2; clang_getFileLocation(start, &file1, nullptr, nullptr, &offset1); clang_getFileLocation(end, &file2, nullptr, nullptr, &offset2); + if (file1 != file2 || offset2 <= offset1) return QString(); QFile file(fromCXString(clang_getFileName(file1))); - if (!file.open(QFile::ReadOnly)) + if (!file.open(QFile::ReadOnly)) { + if (file.fileName() == fnDummyFileName) + return QString::fromUtf8(ClangCodeParser::fn().mid(offset1, offset2 - offset1)); return QString(); + } file.seek(offset1); return QString::fromUtf8(file.read(offset2 - offset1)); } @@ -1595,6 +1602,7 @@ void ClangCodeParser::parseSourceFile(const Location & /*location*/, const QStri clang_disposeTranslationUnit(tu); clang_disposeIndex(index_); namespaceScope_.clear(); + fn_.clear(); } /*! @@ -1673,17 +1681,17 @@ Node *ClangCodeParser::parseFnArg(const Location &location, const QString &fnArg args.push_back(pchName_.constData()); } CXTranslationUnit tu; - QByteArray fn; + fn_.clear(); for (const auto &ns : qAsConst(namespaceScope_)) - fn.prepend("namespace " + ns.toUtf8() + " {"); - fn += fnArg.toUtf8(); - if (!fn.endsWith(";")) - fn += "{ }"; - fn.append(namespaceScope_.size(), '}'); - - const char *dummyFileName = "/fn_dummyfile.cpp"; - CXUnsavedFile unsavedFile { dummyFileName, fn.constData(), - static_cast<unsigned long>(fn.size()) }; + fn_.prepend("namespace " + ns.toUtf8() + " {"); + fn_ += fnArg.toUtf8(); + if (!fn_.endsWith(";")) + fn_ += "{ }"; + fn_.append(namespaceScope_.size(), '}'); + + const char *dummyFileName = fnDummyFileName; + CXUnsavedFile unsavedFile { dummyFileName, fn_.constData(), + static_cast<unsigned long>(fn_.size()) }; CXErrorCode err = clang_parseTranslationUnit2(index, dummyFileName, args.data(), args.size(), &unsavedFile, 1, flags, &tu); qCDebug(lcQdoc) << __FUNCTION__ << "clang_parseTranslationUnit2(" << dummyFileName << args diff --git a/src/qdoc/clangcodeparser.h b/src/qdoc/clangcodeparser.h index 9af292e67..1575d31fb 100644 --- a/src/qdoc/clangcodeparser.h +++ b/src/qdoc/clangcodeparser.h @@ -62,6 +62,7 @@ public: void parseSourceFile(const Location &location, const QString &filePath) override; void precompileHeaders() override; Node *parseFnArg(const Location &location, const QString &fnArg) override; + static const QByteArray &fn() { return fn_; } private: void getDefaultArgs(); @@ -79,6 +80,7 @@ private: std::vector<const char *> args_; QVector<QByteArray> moreArgs_; QStringList namespaceScope_; + static QByteArray fn_; }; QT_END_NAMESPACE diff --git a/src/qdoc/config.cpp b/src/qdoc/config.cpp index 1387fb411..9ff22c8b1 100644 --- a/src/qdoc/config.cpp +++ b/src/qdoc/config.cpp @@ -57,7 +57,6 @@ QString ConfigStrings::DEFINES = QStringLiteral("defines"); QString ConfigStrings::DEPENDS = QStringLiteral("depends"); QString ConfigStrings::DESCRIPTION = QStringLiteral("description"); QString ConfigStrings::DOCBOOKEXTENSIONS = QStringLiteral("usedocbookextensions"); -QString ConfigStrings::EDITION = QStringLiteral("edition"); QString ConfigStrings::ENDHEADER = QStringLiteral("endheader"); QString ConfigStrings::EXAMPLEDIRS = QStringLiteral("exampledirs"); QString ConfigStrings::EXAMPLES = QStringLiteral("examples"); diff --git a/src/qdoc/config.h b/src/qdoc/config.h index f8823d521..933aad543 100644 --- a/src/qdoc/config.h +++ b/src/qdoc/config.h @@ -228,7 +228,6 @@ struct ConfigStrings static QString DEPENDS; static QString DESCRIPTION; static QString DOCBOOKEXTENSIONS; - static QString EDITION; static QString ENDHEADER; static QString EXAMPLEDIRS; static QString EXAMPLES; @@ -315,7 +314,6 @@ struct ConfigStrings #define CONFIG_DEPENDS ConfigStrings::DEPENDS #define CONFIG_DESCRIPTION ConfigStrings::DESCRIPTION #define CONFIG_DOCBOOKEXTENSIONS ConfigStrings::DOCBOOKEXTENSIONS -#define CONFIG_EDITION ConfigStrings::EDITION #define CONFIG_ENDHEADER ConfigStrings::ENDHEADER #define CONFIG_EXAMPLEDIRS ConfigStrings::EXAMPLEDIRS #define CONFIG_EXAMPLES ConfigStrings::EXAMPLES diff --git a/src/qdoc/doc/config/qdoc.qdocconf b/src/qdoc/doc/config/qdoc.qdocconf index f29b20aaf..a850d3eb6 100644 --- a/src/qdoc/doc/config/qdoc.qdocconf +++ b/src/qdoc/doc/config/qdoc.qdocconf @@ -65,4 +65,6 @@ depends += \ qtwidgets \ qtxml +ignorewords += QDoc + navigation.landingpage = "QDoc Manual" diff --git a/src/qdoc/doc/examples/samples.qdocinc b/src/qdoc/doc/examples/samples.qdocinc index afe634326..1b83428b2 100644 --- a/src/qdoc/doc/examples/samples.qdocinc +++ b/src/qdoc/doc/examples/samples.qdocinc @@ -62,10 +62,10 @@ \page generic-guide.html \title Generic QDoc Guide \nextpage Creating QDoc Configuration Files - There are three essential materials for generating documentation with qdoc: + There are three essential materials for generating documentation with QDoc: \list - \li \c qdoc binary + \li \c QDoc binary (\c {qdoc}) \li \c qdocconf configuration files \li \c Documentation in \c C++, \c QML, and \c .qdoc files \endlist diff --git a/src/qdoc/doc/qa-pages.qdoc b/src/qdoc/doc/qa-pages.qdoc index 1e3ca19f4..47f57eb38 100644 --- a/src/qdoc/doc/qa-pages.qdoc +++ b/src/qdoc/doc/qa-pages.qdoc @@ -32,14 +32,14 @@ \title QA Pages - qdoc can generate some extra HTML pages that can be useful for - debugging qdoc documentation. These \e QA pages make it easier for + QDoc can generate some extra HTML pages that can be useful for + debugging QDoc documentation. These \e QA pages make it easier for those who write documentation to find links that either go to the wrong targets or don't go anywhere at all. \section2 Generating the QA Pages - Add \c {-write-qa-pages} to the command line to tell qdoc to + Add \c {-write-qa-pages} to the command line to tell QDoc to generate the QA pages. If this option is not provided, the QA pages will not be generated, and previolusly generated QA pages will be deleted. @@ -49,7 +49,7 @@ The main QA page for a module is not linked into the module's generated documentation, but it is located in the same output directory. To find the top-level QA page for module \e {xxx}, set - your browser to the qdoc output directory for module \e {xxx}. + your browser to the QDoc output directory for module \e {xxx}. Several files whose names begin with \e {aaa} appear at the top of the list. These are the QA pages for module \e{xxx}. The file names begin with \e {aaa} to ensure that they are easy to find at @@ -83,11 +83,11 @@ QtCore to QtQuick. The first column of each table entry contains a link to some link in QtCore. The link text as it appears in QtCore is shown. The second and third columns contain the source - file name and line number for where qdoc saw the link in a qdoc + file name and line number for where QDoc saw the link in a qdoc comment. \note The line number will normally refer to the first line of the - comment where qdoc saw the link. + comment where QDoc saw the link. Clicking on a link in the table takes you to that link in the documentation. There the link will be marked with three red diff --git a/src/qdoc/doc/qdoc-guide/qdoc-guide.qdoc b/src/qdoc/doc/qdoc-guide/qdoc-guide.qdoc index c964493bc..f1e602dc2 100644 --- a/src/qdoc/doc/qdoc-guide/qdoc-guide.qdoc +++ b/src/qdoc/doc/qdoc-guide/qdoc-guide.qdoc @@ -37,7 +37,7 @@ \l{writing-markup}{mark up} to enhance the layout and formatting of the final output. - There are three essential materials for generating documentation with qdoc: + There are three essential materials for generating documentation with QDoc: \list \li \c QDoc binary \li \c qdocconf configuration files @@ -95,12 +95,12 @@ can style the documentation in DITA at a later time. DITA XML is therefore more flexible in allowing different styles to apply to the same information. - To run qdoc, the project configuration file is supplied as an argument. + To run QDoc, the project configuration file is supplied as an argument. \code qdoc project.qdocconf \endcode - The project configuration contains information that qdoc uses to create the + The project configuration contains information that QDoc uses to create the documentation. \section2 Project Information @@ -267,7 +267,7 @@ comment; the comment itself and anything after it, until a newline, is omitted from the generated output. - QDoc will parse C++ and QML files to look for qdoc comments. To explicitly + QDoc will parse C++ and QML files to look for QDoc comments. To explicitly omit a certain file type, omit it from the \l{Input and Output Directories}{configuration} file. @@ -280,7 +280,7 @@ \target writing-topic-commands \section2 QDoc Topics - Each qdoc comment must have a \e topic type. A topic distinguishes it from + Each QDoc comment must have a \e topic type. A topic distinguishes it from other topics. To specify a topic type, use one of the several \l{Topic Commands}{topic commands}. @@ -638,6 +638,10 @@ install the \c libclang-dev package and its dependencies. For running QDoc, the \c libclang package is required. + \note On Windows, after installing the pre-built LLVM you must restart your + build shell to ensure that LLVM's binary directory is added to the PATH + variable. This is needed to be able to run qdoc. + \section1 Set Clang location automatically The Qt build system uses the tool \c llvm-config to discover the location diff --git a/src/qdoc/doc/qdoc-manual-cmdindex.qdoc b/src/qdoc/doc/qdoc-manual-cmdindex.qdoc index 77a3266fb..430fdf0f8 100644 --- a/src/qdoc/doc/qdoc-manual-cmdindex.qdoc +++ b/src/qdoc/doc/qdoc-manual-cmdindex.qdoc @@ -68,6 +68,7 @@ \li \l {image-command} {\\image} \li \l {include-command} {\\include} \li \l {ingroup-command} {\\ingroup} + \li \l {inheaderfile-command}{\\inheaderfile} \li \l {inherits-command}{\\inherits} \li \l {inlineimage-command} {\\inlineimage} \li \l {inmodule-command} {\\inmodule} @@ -117,6 +118,7 @@ \li \l {quotefile-command} {\\quotefile} \li \l {quotefromfile-command} {\\quotefromfile} \li \l {raw-command} {\\raw} + \li \l {readonly-command} {\\readonly} \li \l {reentrant-command} {\\reentrant} \li \l {reimp-command} {\\reimp} \li \l {relates-command} {\\relates} diff --git a/src/qdoc/doc/qdoc-manual-contextcmds.qdoc b/src/qdoc/doc/qdoc-manual-contextcmds.qdoc index 3d69e76a6..52f27290f 100644 --- a/src/qdoc/doc/qdoc-manual-contextcmds.qdoc +++ b/src/qdoc/doc/qdoc-manual-contextcmds.qdoc @@ -37,7 +37,8 @@ \list \li Is this class thread-safe? \li Is this function reentrant? - \li Of which module is this class a member ? + \li Of which module is this class a member? + \li Which include statement is needed to use this class? \endlist Context commands can appear anywhere in a QDoc comment, @@ -47,6 +48,7 @@ \list \li \l {abstract-command} {\\abstract} \li \l {ingroup-command}{\\ingroup}, + \li \l {inheaderfile-command}{\\inheaderfile}, \li \l {inherits-command}{\\inherits}, \li \l {inmodule-command}{\\inmodule}, \li \l {internal-command}{\\internal}, @@ -57,6 +59,7 @@ \li \l {preliminary-command}{\\preliminary}, \li \l {previouspage-command}{\\previouspage}, \li \l {qmlabstract-command} {\\qmlabstract} + \li \l {readonly-command} {\\readonly} \li \l {reentrant-command}{\\reentrant}, \li \l {reimp-command}{\\reimp}, \li \l {relates-command}{\\relates}, @@ -243,6 +246,31 @@ * / \endcode + \target inheaderfile-command + \section1 \\inheaderfile + + The \\inheaderfile meta-command is used for overriding the include statement + generated for a C++ class, namespace, or header file reference documentation. + + By default, QDoc documents a \c {\class SomeClass} to be available with + a following include statement: + + \code + #include <SomeClass> + \endcode + + If the actual include statement differs from the default, this can be + documented as + + \badcode + \class SomeClass + \inheaderfile Tools/SomeClass + ... + \endcode + + See also \l {class-command}{\\class} and + \l {headerfile-command}{\\headerfile}. + \target obsolete-command \section1 \\obsolete @@ -379,6 +407,12 @@ \endlist \endquotation + \target readonly-command + \section1 \\readonly + + The \\readonly command is used in conjunction with a \l {qmlproperty-command} + {\\qmlproperty} command to mark the QML property as read-only. + \target since-command \section1 \\since diff --git a/src/qdoc/doc/qdoc-manual-intro.qdoc b/src/qdoc/doc/qdoc-manual-intro.qdoc index a943863a6..525445b4f 100644 --- a/src/qdoc/doc/qdoc-manual-intro.qdoc +++ b/src/qdoc/doc/qdoc-manual-intro.qdoc @@ -88,7 +88,7 @@ \section1 Running QDoc - The name of the QDoc program is \c {qdoc}. To run qdoc from the + The name of the QDoc program is \c {qdoc}. To run QDoc from the command line, give it the name of a configuration file: \quotation @@ -284,7 +284,7 @@ For each QDoc comment it finds, it searches the master tree for the item where the documentation belongs. Then it interprets the - qdoc commands in the comment and stores the interpreted commands + QDoc commands in the comment and stores the interpreted commands and the comment text in the tree node for the item. Finally, QDoc traverses the master tree. For each node, if the diff --git a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc index 6fc16c9e1..69d10fb9a 100644 --- a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc +++ b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc @@ -206,9 +206,9 @@ text (which may include other QDoc commands) to which special formatting attributes should be applied. - An argument must be provided in curly braces, as in the qdoc + An argument must be provided in curly braces, as in the QDoc comment shown below. The argument is not interpreted but is used - as attribute(s) of the tag that is output by qdoc. + as attribute(s) of the tag that is output by QDoc. For example, we might want to render an inline image so that it floats to the right of the current block of text: @@ -222,7 +222,7 @@ * / \endcode - If qdoc is generating HTML, it will translate these commands to: + If QDoc is generating HTML, it will translate these commands to: \code <div class="float-right"><p><img src="images/qml-column.png" /></p></div> @@ -1699,7 +1699,7 @@ ... \endcode - By default, qdoc looks for \c{//!} as a code snippet marker. + By default, QDoc looks for \c{//!} as a code snippet marker. For \c{.pro}, \c{.py}, \c{.cmake}, and \c{CMakeLists.txt} files, \c {#!} is detected. Finally, \c{<!--} is accepted in \c{.html}, \c{.qrc}, \c{.ui}, \c{.xml}, \c{.dita}, and \c{.xq} files. @@ -1805,7 +1805,7 @@ \li \c {\l QWidget::removeAction(QAction* action)} - The signature of a function with parameters. If an exact match is not found, the - link is not satisfied and qdoc reports a \e {Can't link to...} error. + link is not satisfied and QDoc reports a \e {Can't link to...} error. \li \c {\l <QtGlobal>} - The subject of a \l {headerfile-command} {\\headerfile} command. @@ -1850,7 +1850,7 @@ \section2 Fixing Ambiguous Links Because of the modularization of Qt beginning with Qt 5.0, The - possibility that qdoc will have to deal with ambiguous links has + possibility that QDoc will have to deal with ambiguous links has increased. An ambiguous link is one that has a matching target in more than one Qt module, e.g. the same section title can appear in more than one Qt module, or the name of a C++ class in one module @@ -1859,7 +1859,7 @@ namespace in QtCore and a QML type in QtQml. Suppose we want to link to the \l {Qt} {Qt C++ namespace}. At the - time qdoc generated this HTML page, that link was correct. Does + time QDoc generated this HTML page, that link was correct. Does it still go to the C++ namespace? Qdoc generated that link from this link command: @@ -1868,22 +1868,22 @@ \endlist Now suppose we want to link to the \l [QML] {Qt} {Qt QML type}. - At the time qdoc generated this HTML page, that link was also + At the time QDoc generated this HTML page, that link was also correct, but we had to use this link command: \list \li \c {\l [QML] {Qt} {Qt QML type}} \endlist - The \e {QML} in \e {square brackets} tells qdoc to accept a + The \e {QML} in \e {square brackets} tells QDoc to accept a matching target only if the traget is on a QML page. Qdoc actually finds the C++ namespace target first, but since that target is on - a C++ page, qdoc ignores it and keeps looking until it finds the + a C++ page, QDoc ignores it and keeps looking until it finds the same target on a QML page. Without the guidance in the \e{\\l command} in the optional \e - {square bracket} argument, qdoc links to the first matching target - it finds. qdoc can't warn that the link was ambiguous in such + {square bracket} argument, QDoc links to the first matching target + it finds. QDoc can't warn that the link was ambiguous in such cases because it doesn't know that another matching target exists. \section2 What arguments can appear in square brackets? @@ -1895,13 +1895,13 @@ The \e {square bracket} argument is only allowed in the \c {\l (link)} command. The example above shows how \c QML is used as the - \e {square brackets} argument to force qdoc to match a QML target. + \e {square brackets} argument to force QDoc to match a QML target. Most often, this will be a QML type, but it can also be a QML member function of property. - In the example, qdoc didn't need a \e {square bracket} argument to + In the example, QDoc didn't need a \e {square bracket} argument to find the Qt C++ namespace page, because that one was the first - matching target qdoc found anyway. However, to force qdoc to find + matching target QDoc found anyway. However, to force QDoc to find a C++ target when a matching QML target gets in the way, \c CPP can be used as the \e {square bracket} argument. For example: @@ -1909,11 +1909,11 @@ \li \c {\l [CPP] {Qt} {Qt C++ namespace}} \endlist - ...will force qdoc to ignore the Qt QML type and continue + ...will force QDoc to ignore the Qt QML type and continue searching until it matches the Qt C++ namespace. If the link target is neither a C++ nor a QML entity, \c {DOC} can - be used as the \e {square bracket} argument to prevent qdoc from + be used as the \e {square bracket} argument to prevent QDoc from matching either of those. At this writing, there were no cases of ambiguous links where using \c {DOC} was required. @@ -1928,7 +1928,7 @@ \endlist When a module name is used as the \e {square bracket} argument, - qdoc will search for link the target in that module only. This + QDoc will search for link the target in that module only. This makes searching for link targets more efficient. Finally, the module name and entity type arguments can be @@ -2710,7 +2710,7 @@ \li Tutorial and Examples \endlist - \warning There appears to be a bug in qdoc here. If you include + \warning There appears to be a bug in QDoc here. If you include any of the argument types, you get a numeric list. We're looking into it. @@ -3796,12 +3796,12 @@ The command must stand on its own line. See \l {Qt Sensors QML Types} for an example. The page is generated from \c {qtsensors5.qdoc}. There you will - find a qdoc comment containing the \c{\qmlmodule} command for the QtSensors - module. The same qdoc comment contains two \c {\annotated-list} commands to + find a QDoc comment containing the \c{\qmlmodule} command for the QtSensors + module. The same QDoc comment contains two \c {\annotated-list} commands to list the QML types in two separate groups. The QML types have been divided into these two groups because it makes more sense to list them this way than it does to list them in a single alphabetical list. At the bottom of the - comment, \c {\noautolist} has been used to tell qdoc not to generate the + comment, \c {\noautolist} has been used to tell QDoc not to generate the automatic annotated list. This command was introduced in QDoc 5.6. @@ -3916,7 +3916,7 @@ \endraw \endquotation - \note But you can achieve the exact same thing using qdoc + \note But you can achieve the exact same thing using QDoc commands. In this case, all you have to do is include the color styles in your style.css file. Then you can write: diff --git a/src/qdoc/doc/qdoc-manual-qdocconf.qdoc b/src/qdoc/doc/qdoc-manual-qdocconf.qdoc index 6d26de344..ef92cc99e 100644 --- a/src/qdoc/doc/qdoc-manual-qdocconf.qdoc +++ b/src/qdoc/doc/qdoc-manual-qdocconf.qdoc @@ -91,7 +91,6 @@ \li \l {Cpp.ignoretokens-variable} {Cpp.ignoretokens} \li \l {defines-variable} {defines} \li \l {depends-variable} {depends} - \li \l {edition-variable} {edition} \li \l {exampledirs-variable} {exampledirs} \li \l {examples-variable} {examples} \li \l {examples.fileextensions-variable} {examples.fileextensions} @@ -244,10 +243,10 @@ line using the -D option. For example: \badcode - currentdirectory$ qdoc -Dconsoleedition qtgui.qdocconf + currentdirectory$ qdoc -Dqtforpython qtgui.qdocconf \endcode - In this case the -D option ensures that the \c consoleedition + In this case the -D option ensures that the \c qtforpython preprocessor symbol is defined when QDoc processes the source files defined in the qtgui.qdocconf file. @@ -305,37 +304,6 @@ See also \l indexes, \l project, and \l url. - \target edition-variable - \section1 edition - - The \c edition variable specifies which modules are included in - each edition of a package, and provides QDoc with information to - provide class lists for each edition. - - This feature is mostly used when providing documentation for Qt - packages. - - The \c edition variable is always used with a particular edition - name to define the modules for that edition: - - \badcode - edition.Console = QtCore QtNetwork QtSql QtXml - edition.Desktop = QtCore QtGui QtNetwork QtOpenGL QtSql QtXml \ - QtDesigner QtAssistant Qt3Support QAxContainer \ - QAxServer - edition.DesktopLight = QtCore QtGui Qt3SupportLight - \endcode - - In the above examples, the \c Console edition only includes the - contents of four modules. Only the classes from these modules will - be used when the \l{Miscellaneous#generatelist-command} - {generatelist} command is used to generate a list of classes for - this edition: - - \badcode - \generatelist{classesbyedition Console} - \endcode - \target exampledirs-variable \section1 exampledirs @@ -422,7 +390,7 @@ \section1 examples.fileextensions The \c examples.fileextensions variable specifies the file - extensions that qdoc will look for when collecting example files + extensions that QDoc will look for when collecting example files for display in the documentation. The default extensions are *.cpp, *.h, *.js, *.xq, *.svg, *.xml @@ -441,7 +409,7 @@ \section1 excludedirs The \c excludedirs variable is for listing directories that should \e{not} - be processed by qdoc, even if the same directories are included by the + be processed by QDoc, even if the same directories are included by the \l {sourcedirs-variable} {sourcedirs} or \l {headerdirs-variable} {headerdirs} variables. @@ -454,7 +422,7 @@ When executed, QDoc will exclude the listed directories from further consideration. Files in these directories will not be - read by qdoc. + read by QDoc. See also \l {excludefiles-variable} {excludefiles}. @@ -462,7 +430,7 @@ \section1 excludefiles The \c excludefiles variable allows you to specify individual files - that should \e{not} be processed by qdoc. + that should \e{not} be processed by QDoc. \badcode excludefiles += $QT_CORE_SOURCES/../../src/widgets/kernel/qwidget.h \ @@ -940,7 +908,7 @@ \section1 naturallanguage The \c naturallanguage variable specifies the natural language - used for the documentation generated by qdoc. + used for the documentation generated by QDoc. \badcode naturallanguage = zh-Hans @@ -949,7 +917,7 @@ By default, the natural language is \c en for compatibility with legacy documentation. - qdoc will add the natural language information to the HTML it + QDoc will add the natural language information to the HTML it generates, using the \c lang and \c xml:lang attributes. See also \l {sourceencoding-variable} {sourceencoding}, @@ -1043,7 +1011,7 @@ \section1 outputencoding The \c outputencoding variable specifies the encoding used for the - documentation generated by qdoc. + documentation generated by QDoc. \badcode outputencoding = UTF-8 @@ -1055,7 +1023,7 @@ languages, this is not sufficient and an encoding such as UTF-8 is required. - qdoc will encode HTML using this encoding and generate the correct + QDoc will encode HTML using this encoding and generate the correct declarations to indicate to browsers which encoding is being used. The \l naturallanguage configuration variable should also be specified to provide browsers with a complete set of character @@ -1188,7 +1156,7 @@ particularly non-European languages, this is not sufficient and an encoding such as UTF-8 is required. - Although qdoc will use the encoding to read source and + Although QDoc will use the encoding to read source and documentation files, limitations of C++ compilers may prevent you from using non-ASCII characters in source code comments. In cases like these, it is possible to write API documentation completely diff --git a/src/qdoc/doc/qdoc-manual-topiccmds.qdoc b/src/qdoc/doc/qdoc-manual-topiccmds.qdoc index e7405e442..8e142f5af 100644 --- a/src/qdoc/doc/qdoc-manual-topiccmds.qdoc +++ b/src/qdoc/doc/qdoc-manual-topiccmds.qdoc @@ -664,6 +664,8 @@ ... \endquotation + See also \l {inheaderfile-command}{\\inheaderfile}. + \target macro-command \section1 \\macro @@ -942,7 +944,7 @@ \li api - This is the type of page used for C++ class references and QML type references. You should never use this one for the pages - you write, because this one is reserved for qdoc. + you write, because this one is reserved for QDoc. \endlist diff --git a/src/qdoc/doc/qtgui-qdocconf.qdoc b/src/qdoc/doc/qtgui-qdocconf.qdoc index 4161c2917..89c46ff94 100644 --- a/src/qdoc/doc/qtgui-qdocconf.qdoc +++ b/src/qdoc/doc/qtgui-qdocconf.qdoc @@ -273,7 +273,7 @@ Add the specified directories to the list of directories containing the \e .cpp \endcode The \c excludedirs variable is for listing directories that should not be processed -by qdoc, even if the same directories are included by the \c sourcedirs or \c headerdirs +by QDoc, even if the same directories are included by the \c sourcedirs or \c headerdirs variables. When executed, QDoc will ignore the directories listed. diff --git a/src/qdoc/generator.h b/src/qdoc/generator.h index f12aff933..dca915ba7 100644 --- a/src/qdoc/generator.h +++ b/src/qdoc/generator.h @@ -159,8 +159,6 @@ protected: static bool hasExceptions(const Node *node, NodeList &reentrant, NodeList &threadsafe, NodeList &nonreentrant); - QMap<QString, QStringList> editionGroupMap; - QMap<QString, QStringList> editionModuleMap; QString naturalLanguage; #ifndef QT_NO_TEXTCODEC QTextCodec *outputCodec; diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp index 104d97bc2..a1a1cd876 100644 --- a/src/qdoc/htmlgenerator.cpp +++ b/src/qdoc/htmlgenerator.cpp @@ -185,19 +185,6 @@ void HtmlGenerator::initializeGenerator() if (naturalLanguage.isEmpty()) naturalLanguage = QLatin1String("en"); - const QSet<QString> editionNames = config->subVars(CONFIG_EDITION); - for (const auto &editionName : editionNames) { - QStringList editionModules = config->getStringList(CONFIG_EDITION + Config::dot - + editionName + Config::dot + "modules"); - QStringList editionGroups = config->getStringList(CONFIG_EDITION + Config::dot + editionName - + Config::dot + "groups"); - - if (!editionModules.isEmpty()) - editionModuleMap[editionName] = editionModules; - if (!editionGroups.isEmpty()) - editionGroupMap[editionName] = editionGroups; - } - codeIndent = config->getInt(CONFIG_CODEINDENT); // QTBUG-27798 codePrefix = config->getString(CONFIG_CODEPREFIX); codeSuffix = config->getString(CONFIG_CODESUFFIX); diff --git a/tests/auto/qdoc/generatedoutput/expected_output/docbook/testqdoc-test.xml b/tests/auto/qdoc/generatedoutput/expected_output/docbook/testqdoc-test.xml index ad6a4f30f..76025b06e 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/docbook/testqdoc-test.xml +++ b/tests/auto/qdoc/generatedoutput/expected_output/docbook/testqdoc-test.xml @@ -63,13 +63,14 @@ <db:para>An inline function, documented using the \fn QDoc command.</db:para> </db:section> <db:section xml:id="someFunction"> -<db:title>Test::int someFunction(int <db:emphasis>v</db:emphasis>)</db:title> +<db:title>Test::int someFunction(int <db:emphasis>v</db:emphasis> = 0)</db:title> <db:methodsynopsis> <db:type>int</db:type> <db:methodname>someFunction</db:methodname> <db:methodparam> <db:type>int</db:type> <db:parameter>v</db:parameter> +<db:initializer>0</db:initializer> </db:methodparam> <db:synopsisinfo db:role="meta">plain</db:synopsisinfo> <db:synopsisinfo db:role="signature">int someFunction(int v)</db:synopsisinfo> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/html/testqdoc-test.webxml b/tests/auto/qdoc/generatedoutput/expected_output/html/testqdoc-test.webxml index d2726cc57..7ae77ec5a 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/html/testqdoc-test.webxml +++ b/tests/auto/qdoc/generatedoutput/expected_output/html/testqdoc-test.webxml @@ -39,7 +39,7 @@ <description/> </function> <function name="someFunction" fullname="TestQDoc::Test::someFunction" href="testqdoc-test.html#someFunction" status="active" access="public" location="testcpp.h" documented="true" meta="plain" virtual="non" const="false" static="false" final="false" override="false" type="int" signature="int someFunction(int v)"> - <parameter type="int" name="v" default=""/> + <parameter type="int" name="v" default="0"/> <description> <para>Function that takes a parameter <argument>v</argument>. Also returns the value of <argument>v</argument>.</para> </description> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/ignoresince/testqdoc-test.html b/tests/auto/qdoc/generatedoutput/expected_output/ignoresince/testqdoc-test.html index 52a10f706..0d4283a8f 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/ignoresince/testqdoc-test.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/ignoresince/testqdoc-test.html @@ -34,7 +34,7 @@ <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="testqdoc-test.html#inlineFunction">inlineFunction</a></b>()</td></tr> -<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunction">someFunction</a></b>(int <i>v</i>)</td></tr> +<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunction">someFunction</a></b>(int <i>v</i> = 0)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunctionDefaultArg">someFunctionDefaultArg</a></b>(int <i>i</i>, bool <i>b</i> = false)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#virtualFun">virtualFun</a></b>()</td></tr> </table></div> @@ -68,7 +68,7 @@ <p>An inline function, documented using the \fn QDoc command.</p> <!-- @@@inlineFunction --> <!-- $$$someFunction[overload1]$$$someFunctionint --> -<h3 class="fn" id="someFunction"><a name="someFunction"></a><span class="type">int</span> Test::<span class="name">someFunction</span>(<span class="type">int</span> <i>v</i>)</h3> +<h3 class="fn" id="someFunction"><a name="someFunction"></a><span class="type">int</span> Test::<span class="name">someFunction</span>(<span class="type">int</span> <i>v</i> = 0)</h3> <p>Function that takes a parameter <i>v</i>. Also returns the value of <i>v</i>.</p> <p>This function was introduced in Test 1.0.</p> <!-- @@@someFunction --> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/scopedenum/testqdoc-test.html b/tests/auto/qdoc/generatedoutput/expected_output/scopedenum/testqdoc-test.html index 3fc1f2bc7..864205274 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/scopedenum/testqdoc-test.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/scopedenum/testqdoc-test.html @@ -40,7 +40,7 @@ <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="testqdoc-test.html#inlineFunction">inlineFunction</a></b>()</td></tr> -<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunction">someFunction</a></b>(int <i>v</i>)</td></tr> +<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunction">someFunction</a></b>(int <i>v</i> = 0)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunctionDefaultArg">someFunctionDefaultArg</a></b>(int <i>i</i>, bool <i>b</i> = false)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#virtualFun">virtualFun</a></b>()</td></tr> </table></div> @@ -85,7 +85,7 @@ <p>An inline function, documented using the \fn QDoc command.</p> <!-- @@@inlineFunction --> <!-- $$$someFunction[overload1]$$$someFunctionint --> -<h3 class="fn" id="someFunction"><a name="someFunction"></a><span class="type">int</span> Test::<span class="name">someFunction</span>(<span class="type">int</span> <i>v</i>)</h3> +<h3 class="fn" id="someFunction"><a name="someFunction"></a><span class="type">int</span> Test::<span class="name">someFunction</span>(<span class="type">int</span> <i>v</i> = 0)</h3> <p>Function that takes a parameter <i>v</i>. Also returns the value of <i>v</i>.</p> <!-- @@@someFunction --> <!-- $$$someFunctionDefaultArg[overload1]$$$someFunctionDefaultArgintbool --> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/template/testqdoc-test.html b/tests/auto/qdoc/generatedoutput/expected_output/template/testqdoc-test.html index 4ec52916a..75643dede 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/template/testqdoc-test.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/template/testqdoc-test.html @@ -34,7 +34,7 @@ <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="testqdoc-test.html#inlineFunction">inlineFunction</a></b>()</td></tr> -<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunction">someFunction</a></b>(int <i>v</i>)</td></tr> +<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunction">someFunction</a></b>(int <i>v</i> = 0)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunctionDefaultArg">someFunctionDefaultArg</a></b>(int <i>i</i>, bool <i>b</i> = false)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#virtualFun">virtualFun</a></b>()</td></tr> </table></div> @@ -73,7 +73,7 @@ <p>An inline function, documented using the \fn QDoc command.</p> <!-- @@@inlineFunction --> <!-- $$$someFunction[overload1]$$$someFunctionint --> -<h3 class="fn" id="someFunction"><a name="someFunction"></a><span class="type">int</span> Test::<span class="name">someFunction</span>(<span class="type">int</span> <i>v</i>)</h3> +<h3 class="fn" id="someFunction"><a name="someFunction"></a><span class="type">int</span> Test::<span class="name">someFunction</span>(<span class="type">int</span> <i>v</i> = 0)</h3> <p>Function that takes a parameter <i>v</i>. Also returns the value of <i>v</i>.</p> <!-- @@@someFunction --> <!-- $$$someFunctionDefaultArg[overload1]$$$someFunctionDefaultArgintbool --> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testcpp.index b/tests/auto/qdoc/generatedoutput/expected_output/testcpp.index index ae997fa52..ae3b4a875 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/testcpp.index +++ b/tests/auto/qdoc/generatedoutput/expected_output/testcpp.index @@ -22,7 +22,7 @@ <parameter type="bool" name="b" default=""/> </function> <function name="someFunction" fullname="TestQDoc::Test::someFunction" href="testqdoc-test.html#someFunction" status="active" access="public" location="testcpp.h" documented="true" meta="plain" virtual="non" const="false" static="false" final="false" override="false" type="int" signature="int someFunction(int v)"> - <parameter type="int" name="v" default=""/> + <parameter type="int" name="v" default="0"/> </function> <function name="someFunctionDefaultArg" fullname="TestQDoc::Test::someFunctionDefaultArg" href="testqdoc-test.html#someFunctionDefaultArg" status="active" access="public" location="testcpp.h" documented="true" meta="plain" virtual="non" const="false" static="false" final="false" override="false" type="void" signature="void someFunctionDefaultArg(int i, bool b)"> <parameter type="int" name="i" default=""/> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html index 84c0c4fe3..49066d0e6 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html @@ -34,7 +34,7 @@ <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="testqdoc-test.html#inlineFunction">inlineFunction</a></b>()</td></tr> -<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunction">someFunction</a></b>(int <i>v</i>)</td></tr> +<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunction">someFunction</a></b>(int <i>v</i> = 0)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunctionDefaultArg">someFunctionDefaultArg</a></b>(int <i>i</i>, bool <i>b</i> = false)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#virtualFun">virtualFun</a></b>()</td></tr> </table></div> @@ -68,7 +68,7 @@ <p>An inline function, documented using the \fn QDoc command.</p> <!-- @@@inlineFunction --> <!-- $$$someFunction[overload1]$$$someFunctionint --> -<h3 class="fn" id="someFunction"><a name="someFunction"></a><span class="type">int</span> Test::<span class="name">someFunction</span>(<span class="type">int</span> <i>v</i>)</h3> +<h3 class="fn" id="someFunction"><a name="someFunction"></a><span class="type">int</span> Test::<span class="name">someFunction</span>(<span class="type">int</span> <i>v</i> = 0)</h3> <p>Function that takes a parameter <i>v</i>. Also returns the value of <i>v</i>.</p> <!-- @@@someFunction --> <!-- $$$someFunctionDefaultArg[overload1]$$$someFunctionDefaultArgintbool --> diff --git a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp index 17045eed5..31b910fae 100644 --- a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp +++ b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp @@ -124,13 +124,7 @@ void Test::someFunctionDefaultArg(int i, bool b = false) return; } -/*! - Function that takes a parameter \a v. - Also returns the value of \a v. -\if defined(test_ignoresince) - \since Test 1.0 -\endif -*/ +// Documented below with an \fn command. Unnecessary but we support it, and it's used. int Test::someFunction(int v) { return v; @@ -143,6 +137,16 @@ int Test::someFunction(int v) */ /*! + \fn int Test::someFunction(int v = 0) + + Function that takes a parameter \a v. + Also returns the value of \a v. +\if defined(test_ignoresince) + \since Test 1.0 +\endif +*/ + +/*! Function that must be reimplemented. */ void Test::virtualFun() diff --git a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h index 4ae33a404..cb812375b 100644 --- a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h +++ b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h @@ -41,7 +41,7 @@ public: OmittedValue = 99 }; #endif - int someFunction(int v); + int someFunction(int v = 0); void someFunctionDefaultArg(int i, bool b); void obsoleteMember(); void anotherObsoleteMember(); diff --git a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp index 40fcdfcac..f8abee1b4 100644 --- a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp +++ b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp @@ -34,6 +34,9 @@ class tst_generatedOutput : public QObject { Q_OBJECT +public: + void setRegenerate() { m_regen = true; } + private slots: void initTestCase(); void init(); @@ -73,6 +76,8 @@ private slots: private: QScopedPointer<QTemporaryDir> m_outputDir; QString m_qdoc; + QDir m_expectedDir; + bool m_regen = false; void runQDocProcess(const QStringList &arguments); void compareLineByLine(const QStringList &expectedFiles); @@ -87,6 +92,7 @@ void tst_generatedOutput::initTestCase() const auto binpath = QLibraryInfo::location(QLibraryInfo::BinariesPath); const auto extension = QSysInfo::productType() == "windows" ? ".exe" : ""; m_qdoc = binpath + QLatin1String("/qdoc") + extension; + m_expectedDir.setPath(QFINDTESTDATA(".") + QLatin1String("/expected_output")); } void tst_generatedOutput::init() @@ -125,8 +131,8 @@ void tst_generatedOutput::runQDocProcess(const QStringList &arguments) void tst_generatedOutput::compareLineByLine(const QStringList &expectedFiles) { for (const auto &file : expectedFiles) { - QString expected(QFINDTESTDATA("/expected_output/" + file)); - QString actual(m_outputDir->path() + "/" + file); + QString expected(m_expectedDir.filePath(file)); + QString actual(m_outputDir->filePath(file)); QFile expectedFile(expected); if (!expectedFile.open(QIODevice::ReadOnly)) @@ -168,6 +174,19 @@ void tst_generatedOutput::testAndCompare(const char *input, const char *outNames for (auto &expectedOut : expectedOuts) expectedOut = QString(outputPathPrefix) + "/" + expectedOut; + if (m_regen) { + QVERIFY(m_expectedDir.mkpath(m_expectedDir.path())); + for (const auto &file : qAsConst(expectedOuts)) { + QFileInfo fileInfo(m_expectedDir.filePath(file)); + fileInfo.dir().remove(fileInfo.fileName()); // Allowed to fail + QVERIFY(m_expectedDir.mkpath(fileInfo.dir().path())); + QVERIFY(QFile::copy(m_outputDir->filePath(file), + fileInfo.filePath())); + } + QSKIP("Regenerated expected output only."); + return; + } + compareLineByLine(expectedOuts); } @@ -400,6 +419,15 @@ void tst_generatedOutput::nestedMacro() "nestedmacro/testcpp-module.html"); } -QTEST_APPLESS_MAIN(tst_generatedOutput) +int main(int argc, char *argv[]) +{ + tst_generatedOutput tc; + // Re-populate expected data and skip tests if option -regenerate is set + if (argc == 2 && QByteArray(argv[1]) == "-regenerate") { + tc.setRegenerate(); + --argc; + } + return QTest::qExec(&tc, argc, argv); +} #include "tst_generatedoutput.moc" |