/**************************************************************************** ** ** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ ** 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 Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page qdoc-warnings.html \previouspage Categories of Documentation \title How to Resolve QDoc Warnings QDoc may issue warnings when generating your documentation set. This section describes what these warnings mean and how to resolve them. This document does not describe warnings generated by Clang. \section1 Can't link to QDoc issues this warning when one part of the documentation (identified in the warning message) tries to refer to another, but doesn't correctly specify that other, the target of the link. This may arise because the reference to it is mistyped or because the target has changed name (for a function or type) or title (for another section). Search the source code for that particular link target. If you get no results, gradually make the search less specific until you find a match. If the link target looks like the name of a type or function, this could also be due to: \list \li The name (or, for functions, where specified, signature) used where it is documented not matching the name used in its declaration. \li The link target being marked as \l {internal-command}{\\internal} when the linking text was not. \endlist \section1 Cannot find snippets file to quote from QDoc issues this warning if it is unable to find the file named after a \l {snippet-command}{\\snippet} or \l {quotefromfile-command}{\\quotefromfile} command. Some useful steps for correcting this: \list \li Check if the snippet file name is correct. QDoc appends the snippet file name to each of the directories given in the search path, to get a path-name for a candidate file to look for. It produces this error when none of these candidates exist. \li Check the search path for snippets, given by the \c exampledirs configuration variable in the \c{*.qdocconf} file. You may need to add an entry to this path, or correct an existing entry. \li Check if the snippet file exists, or if it has been moved, renamed or removed, which may happen when there are changes to the source code that QDoc tries to quote from. \endlist \section1 Unexpected \\snippet QDoc issues this warning if it is unable to locate the snippet file quoted in a \l {snippet-command}{\\snippet} command. \section1 Undocumented return value For functions whose return-type is not void, QDoc checks if the return value is documented. This warning is issued if the documentation for a function or method doesn't contain a word starting with "return". \section1 Undocumented parameter QDoc requires the documentation of a function or method to describe every parameter. It recognizes this by each parameter name (as specified where the function or method is declared in a header file) appearing after a \l {a-command}{\\a} command. \section1 No such parameter QDoc issues this warning when the parameter name given after an \l{a-command}{\\a} command does not match any of the parameters named in the header-file's declaration of the function or method being documented. \section1 Unknown macro QDoc issues this warning when it sees a backslash, \c{\}, followed by a token it does not recognize as the name of a \l {macro-variable}{built-in command} or a \l {alias-variable}{user-defined macro}. When quoting code that contains character escape sequences, you should enclose the code in \\c{...} to prevent this warning against the escape sequences. \section1 Clang couldn't find function when parsing \\fn When Clang parses a function statement after \l {fn-command}{\\fn}, it checks this against the declaration in the header file. If Clang discovers discrepancies, it issues this warning message. \section1 C++ class not found: \\instantiates If you describe a QML type, you may specify the class it instantiates. Refer to the \l{instantiates-command}{\\instantiates} command in the \l {QDoc manual}. QDoc issues this warning if it failed to locate the documentation for the C++ class . Either the class is undocumented, it is marked \l {internal-command}{\\internal}, or it originates from another documentation module and QDoc did not locate an index file for the corresponding dependency. See also \l {depends-variable}{depends}. \section1 Cannot tie this documentation to anything QDoc found a \beginqdoc ... \endqdoc comment, with no \l{Topic Commands}{topic command}, that was not immediately followed by a class, function or property definition. It thus does not know what the comment documents. \section1 This qdoc comment contains no topic command (e.g., \\module, \\page) If a QDoc comment doesn't contain a \l {Topic Commands}{topic command}, QDoc does not know what the comment documents, and issues this warning. Very similar to \l {Cannot tie this documentation to anything}, but specific to comments that are not in C++ or QML files. \section1 documented more than once QDoc issues this warning when it finds two comments that document the same item. The location of the previously seen comment is provided in warning details. For example, you see this warning when a function has a documentation comment preceding its definition, and a separate \\fn comment elsewhere. \section1 Namespace documented more than once This warning means that a documentation set contains two comments containing \l {namespace-command}{\\namespace} commands with the same argument, . \section1 is documented, but namespace is not documented in any module The documentation for \e {} was found, but \e{} is declared under a namespace that is either undocumented or QDoc was unable to locate the documentation for it. This can be resolved by either documenting \e{}, or if it is already documented in another module, ensure that this module has a dependency to it. See also \l {depends-variable}{depends} and {indexes-variable}{indexes}. \section1 Clang couldn't find function when parsing \\fn When parsing a \l {fn-command}{\\fn} statement, Clang compares this with the function declaration in the header file. If the signature differs Clang issues this warning. \note \list \li A member of a class or namespace needs to include the class or namespace prefix on the member name. \li A \\fn with no return type matches, regardless of the actual return type, but if it specifies an incorrect return type, it doesn't. \li Differences in \\fn's parameter names don't preclude matching, although the \l {a-command}{\\a} commands in the comment must use the names in the declaration. \endlist \section1 Has no \\inmodule command QDoc issues this warning if the QDoc comments do not relate a class, namespace, or headerfile to a module with the \l{inmodule-command}{\\inmodule} command. If the QDoc comment describes an entity that's not a member of some other entity (typically a namespace or class), it should use either \l {relates-command}{\\relates} or \l {inmodule-command}{\\inmodule} to associate it with its broader context. This warning is raised if it does not. \section1 Cannot find specified with \\ in any header file This means that QDoc cannot find a declaration of in any header file, but has found a comment that claims to document it. An example: \badcode Cannot find 'Color::Red' specified with '\enum' in any header file. \endcode A documentation comment claims to describe an enum, but QDoc didn't find a definition of that enum in a header file. This may also be due to: \list \li a typo in or \li a missing namespace-or-class prefix \li having moved to another namespace or class \endlist \section1 Unrecognizable QML module/component qualifier for A parameter passed to \l {qmlproperty-command}{\\qmlproperty} or \l {qmlmethod-command}{\\qmlmethod} contains a combination of qmlModule::qmlType::identifier that is not defined anywhere. Example: \badcode Unrecognizable QML module/component qualifier for real QtQuick::DragHandler::DragAxis::minimum \endcode DragHandler doesn't have a property called DragAxis. \section1 Missing property type for A declaration of a \l {qmlproperty-command}{\\qmlproperty} is missing its property type. The \\qmlproperty command expects to be followed by the property type, then the fully-qualified name of the property (i.e. the name ::-joined after the name of the class it belongs to). Incorrect: \badcode \qmlproperty MyWidget::count \endcode Correct: \badcode \qmlproperty int MyWidget::count \endcode \section1 QML property documented multiple times: QDoc uses this warning when it finds two QDoc comments that document the same QML property, either by appearing just before its definition, or using the \l {qmlproperty-command}{\\qmlproperty} command. \section1 Command not allowed with QML/JS property commands Example: \badcode \qmlproperty real QtQuick.Controls::RangeSlider::first.value \qmlproperty real QtQuick.Controls::RangeSlider::first.position \qmlproperty real QtQuick.Controls::RangeSlider::first.visualPosition \qmlsignal void QtQuick.Controls::RangeSlider::first.moved() \qmlsignal void QtQuick.Controls::RangeSlider::second.moved() \endcode Error message: \badcode Command '\\qmlsignal' not allowed with QML/JS property commands \endcode This warning is specific to property group documentation. QDoc allows multiple (qml|js)property or (qml|js)attachedproperty topic commands in a single documentation comment to document a property group where the last element in the path is .. Any other topic commands triggers this warning. \section1 Cannot find base function for in QDoc produces this warning if \\reimp is used to document a method, as an override of a virtual method, when no base class has a virtual method with the given name and signature. This may happen because the method it was written to override has changed its signature, or is no longer virtual. \section1 Illegal \\reimp; no documented virtual function for Qdoc tries to create a link to the function that this one reimplements, but it could not find the link target, likely because that function is not documented. This can also arise if no base class has a virtual method with this name and signature; which might arise due to a renaming, a change in signature or the base no longer declaring it virtual. \section1 tries to inherit itself The \l {inherits-command}{\\inherits} command is used to document that a QMl type inherits some other QML type. This warning is issued if that other QML type is the same as the QML type documented. Example: \badcode \qmltype Foo \inherits Foo \endcode \section1 \\instantiates is only allowed in \\qmltype The \l{instantiates-command}{\\instantiates} command can only be used in a QDoc comment that documents a QML type. \section1 All properties in a group must belong to the same type: When documenting QML property groups, all properties listed in the comment block must belong to the same QML type. \section1 Cannot find project file for example In the example's source directory, QDoc expects to find a project file named \c{CMakeLists.txt}, or a file with a \c{.pro}, \c{.qmlproject}, or \c{.pyproject} extension where the base name matches that of the example directory. For example, \c {examples/mymodule/helloworld/helloworld.pro}. \section1 Command name cannot stand for both and QDoc issues this warning when one name is \l {alias-variable}{aliased} to more than one command when reading the configuration. \section1 Cannot open file to quote from: The search path for is defined by the following variables in the \c{.qdocconf} file: \c{sources}, \c{sourcedirs}, and \c{exampledirs}. QDoc failed to find a file named in a command (such as \l {quotefromfile-command}{\\quotefromfile}, \l {snippet-command}{\\snippet}, \l {include-command}{\\include}) that tells it to retrieve content from the named file. It searches each directory named in the search path. If there is no file with this name in any of those directories, or the file is found but not readable, QDoc issues this warning. Check that the combination of search path and is correctly spelled, and that you have read permissions for the file. \note may include a directory name prefix; the whole is appended to each directory in the search path. \sa {Cannot find qdoc include file } \section1 Missing format name after \\raw The \l {raw-command}{\\raw} command and the corresponding \l {raw-command}{\\endraw} command delimit a block of raw mark-up language code. The \\raw command must be followed by the format name. For now, this can only be HTML. \section1 Macro cannot have both format-specific and qdoc-syntax definitions A \l {macro-variable}{\\macro} that specifies an output format cannot also have a generic definition. An example of a configuration that triggers this warning: \badcode macro.gui = \b macro.gui.HTML = "\1" \endcode \section1 Unknown command When a QDoc comment uses a backslash followed by a token that is not a QDoc built-in command and has not been defined as a custom command using \l {alias-variable}{\\alias} or \l {macro-variable}{macro}, QDoc produces this warning. Check the spelling of the command name and look to see if your QDoc configuration has neglected to include whatever would have defined it, if it is a custom command. This may also be produced due to code being quoted in the QDoc comment, for example the author may have referred to the C string termination character \c{'\0'} or one of the other C string escape sequences such as \c{'\n'} without escaping the backslash. Escape the backslash as \c{\} to include a literal backslash in the documentation, or enclose the code fragment in \c{\c{...}}, which suppresses interpretation of backslashes as introducing QDoc commands. \section1 Duplicate target name This means that there are two \l {target-command}{\\target} commands with the same parameter. They should be unique. This warning is followed by the warning "The previous occurrence is here". \section1 Cannot find qdoc include file QDoc failed to find an include file named in a command. QDoc searches each directory named in the search path. If there is no file with this name in any of those directories, or the file found in that search is not readable, QDoc issues this warning. Check that the combination of search path and is correctly spelled, and that you have read permissions for the file. \note may include a directory name prefix; the whole is appended to each directory in the search path. \sa {Cannot open file to quote from: } \section1 Cannot find in This means QDoc cannot find the identifier in the \l{include-command}{\\include} or {snippet-command}{\\snippet} . \section1 Empty qdoc snippet in The snippet was found in the \l {snippet-command}{\\snippet} , but it is empty. \section1 Cannot nest commands This warning concerns formatting commands: bold, italic, index, link, span, subscript, superscript, teletype, uicontrol, underline. A formatting command cannot be used within the text it applies to. An example of this: \badcode There is \b{no \b{super-}bold}. \encode \section1 Can't use in This warning is issued for commands that cannot be nested. Example: \badcode \list \li \table \row \li Hello \li Hi \endtable \endlist \endcode Results in the QDoc warning "Can't use '\\table' in '\\list'". \section1 Missing before Some examples: \list \li The \l {li-command}{\\li} command can only be used inside a \l {list-command}{\\list} or a \l {row-command}{\\row} of a \l {table-command}{\\table}. \li The \l {row-command}{\\row} and \l {header-command}{\\header} commands can only be used within a \l {table-command}{\\table}. \endlist \section1 Unexpected This warning is issued if, for example, you have an \l {list-command}{\\endlist} without a preceding \l {list-command}{\\list}. It applies to all commands that come in pairs (e.g. startFoo/endFoo). \section1 Missing comma in \\sa The titles listed for a \l {sa-command}{\\sa} command should be separated from one another with commas. \section1 Macro does not have a default definition QDoc is attempting to expand a macro, and expects that macro to have a default definition. Some macros may only have format-specific definitions. Example: \badcode macro.pi.HTML = "π" # encodes the pi symbol for HTML output format \endcode There are however instances where macro expansion requires a format-independent macro. For example, you can have macros in section titles, but they must have default definitions. \section1 Macro invoked with too few arguments (expected , got ) The given macro needs more parameters than it was given. See the definition of the macro in the configuration for further details. \section1 Unbalanced parentheses in Points to a '(' without a corresponding ')', or vice versa. \section1 No documentation for Example: \badcode Warning "No documentation for QNativeInterface." \endcode QDoc detects the declaration of namespace QNativeInterface in a header file, but does not find a QDoc comment where that namespace has been documented. \section1 No such enum item in Example: \badcode Cannot find 'QSGMaterialRhiShader::RenderState::DirtyState' specified with \enum in any header file. \endcode QDoc issues this warning when it finds a \l{value-command}{\\value} directive in an \l{enum-command}{\\enum} comment that names a value not found in the header file that declared the enumerated type documented. \section1 Undocumented enum item in 's \l {value-command}{\\value} or \l {omitvalue-command}{\\omitvalue} entries did not include one for \l {enum-command}{}, which is named in the declaration of in the header file. \section1 Failed to find index: Example: \badcode Failed to find index: path/to/QtCrator/appmanplugin/manual.index \endcode In this case, it clearly means the indexes variable contains a typo in the path of the index file. Incorrect: \badcode indexes += path/to/QtCrator/appmanplugin/manual.index \endcode Correct: \badcode indexes += path/to/QtCreator/appmanplugin/manual.index \endcode \section1 \\generatelist examplefiles can only be used with \\example topic command The command "\\generatelist examplefiles" can only be used in example documentation (i.e., when the topic command is \\example). \section1 \\generatelist is empty Below a short overview of all possible arguments for \l {generatelist-command}{\\generatelist}: \list \li \\generatelist annotatedexamples \li \\generatelist annotatedattributions \li \\generatelist classes \li \\generatelist classesbymodule \li \\generatelist qmltypesbymodule \li \\generatelist jstypesbymodule \li \\generatelist examplesfiles \li \\generatelist exampleimages \li \\generatelist functionindex \li \\generatelist legalese \li \\generatelist overviews \li \\generatelist attributions \li \\generatelist related \endlist QDoc issues this warning if you specify \c{\generatelist } and the group does not contain any items, or if you specify \c{\generatelist } and no item in the group matches the pattern. \section1 \\generatelist no such group This warning issues if the argument to \l {generatelist-command}{\\generatelist} is a non-existing group. Example: \code \generatelist draganddrop \endcode This statement generates a list of classes or QML types in the draganddrop group. Classes or QML types are added to the draganddrop group by the \c{\l {ingroup-command}{\ingroup} draganddrop} command in their \l {class-command}{\\class} or \l {qmltype-command}{\\qmltype} comment. QDoc issues this warning message if no entity has this \c{\ingroup draganddrop} statement. \section1 Missing image: The search path to the image is wrong, or the image file does not exist. \section1 Can't link to This can have a variety of causes: \list \li The link target has not been defined with a QDoc topic command, e.g. {title-command}{\\title} . \li The contains a typo. \li The document that contains that link target did not get compiled. \li The document that contains that link target is in a module that is not in the compilation path. \li The link target is in another module, and a dependency to that module was not set in the configuration or QDoc failed to locate the index file for the dependency. \endlist \section1 Could not resolve QML import statement for type QDoc issues this warning if you document a QML type, but omit the \l{inqmlmodule-command}{\\inqmlmodule} command. Example: \badcode Could not resolve QML import statement for type 'ItemSelectionModel' \encode Incorrect: \badcode \qmltype ItemSelectionModel \instantiates QItemSelectionModel \since 5.5 \ingroup qtquick-models \endcode Correct: \badcode \qmltype ItemSelectionModel \instantiates QItemSelectionModel \inqmlmodule QtQml.Models \since 5.5 \ingroup qtquick-models \endcode \section1 \\brief statement does not end with a full stop The argument to the \\brief command is a sentence, summarizing the topic documented, so should end in a full stop. It should also be brief. \section1 QtDeclarative not installed; cannot parse QML or JS QDoc issues this warning if it has been compiled without support for QML/JS parsing. This should not happen unless you have a custom build of QDoc. \section1 Invalid regular expression Some QDoc commands take regular expressions as parameters. QDoc gives this warning when the text given as such a parameter is not a valid regular expression, usually due to it containing characters with special meanings in regular expressions, that should have been escaped. Example: \badcode notifications.qdoc:56: (qdoc) warning: Invalid regular expression '^})$' \endcode \badcode \quotefromfile webenginewidgets/notifications/data/index.html \skipuntil resetPermission \endcode Invalid regular expression: \badcode \printuntil /^})$/ \endcode Valid regular expression: \badcode \printuntil /^\}\)$/ \endcode The \l {printuntil-command}{\\printuntil} command prints until it meets a line consisting of only a right curly brace followed by a right parenthesis. In this case, the curly brace and the parenthesis need to be escaped because they have special meanings in regular expressions. \section1 Multiple index files found for dependency : Using as index file for dependency Multiple \c{-indexdir} paths were passed to QDoc as command line options, and more than one contained an \c{.index} file that matches a dependency. QDoc picks the one with the latest timestamp automatically. Typically, this warning indicates that there are build artifacts left from a previous documentation build. \section1 Cannot locate index file for dependency Example: \badcode "QMake" Cannot locate index file for dependency "activeqt" \endcode The documentation project QMake could not locate activeqt.index in any of the specified index directories. In this case, the specified index directories are specified in qmake.qdocconf. \section1 Dependent modules specified, but no index directories were set. QDoc expected to see one or more -indexdir arguments on the command line. Without them, QDoc cannot locate the index files of any dependencies defined with the 'depends' configuration variable. \section1 Overrides a previous doc QDoc issues this warning when it finds two comments that appear to describe the same entity. The location of the previously seen comment is provided in warning details. \section1 Unrecognized list style \\list can take an optional argument: a single number or character that modifies the list style. Refer to the {list-command}{\\list} documentation for more details. If you use an argument that is not recognized, QDoc issues this warning. \section1 Unable to parse QML snippet: at line , column QDoc comments can contain QML code. This code can be found in a snippet, or in the QDoc comments delimited by \l {qml-command}{\\qml} and {endqml-command}{\\endqml}. Example: If there is a syntax error in the QML code, QDoc issues the warning \badcode Unable to parse QML snippet: Syntax error at line 97, column 42 \endcode Snippets can also contain QML and also there the code is checked. If there is for example a missing curly brace in the code, QDoc issues the warning \badcode Unable to parse QML snippet: Expected token '{' at line 63, column 52 \endcode QDoc often fails to parse incomplete QML snippets; in these cases, it's often OK to replace the \\qml ... \\endqml commands with \\code ... \\endcode to suppress this warning. \section1 Command failed at end of file Example: \badcode Command "\snippet (//! [2]) failed at end of file qmlbars/qml/qmlbars/main.qml". \endcode In this case the warning means that the \l {snippet-command}{\\snippet} command did not find a second label "\/\/! [2]" to mark the end of the snippet. It could also mean that it didn't find any occurrence of that snippet tag in this snippet file. Another example: \badcode Command '\skipto' failed at end of file 'styling/CMakeLists.txt". \endcode The \l {skipto-command}{\\skipto} + moves the cursor to the next line containing that pattern. If \\skipto doesn't find it, QDoc issues this warning. \section1 Failed to open for writing This warning clearly means it cannot open a file for writing, probably because of a wrong path, or permission to write in a certain directory. \section1 This page title exists in more than one file The \l {title-command}{\\title} command sets the title for a page. \code \page activeqt-server.html \title Building ActiveX servers in Qt \endcode QDoc issues this warning if a certain title is used in more than one page. \section1 The content is too long QDoc uses a fixed-size buffer when tokenizing source files. If any single token in the file has more characters than the maximum limit, QDoc issues this warning. While QDoc continues parsing the file, only the part of the token that fits into the buffer is considered, meaning that the output might be mangled. To resolve this warning, the relevant content must be reduced in size, either by splitting it, if possible, or by removing some of its parts. The maximum amount of characters for a single token is shown alongside the warning, for example: \badcode file.qdoc:71154: (qdoc) warning: The content is too long. [The maximum amount of characters for this content is 524288. Consider splitting it or reducing its size.] \endcode \note Since content that is too long is not parsed in full, QDoc may issue warnings that are false positives. Resolve all warnings of this type before fixing other warnings. */