diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index a819026d813572ce08d040484984a493ce38408e..7298d1ec24d9cf35aa6eaa61d9d8ed30bb4a1550 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -2651,8 +2651,10 @@ void CppCodeParser::createExampleFileNodes(DocumentNode *dn) fullPath.truncate(fullPath.lastIndexOf('/')); QStringList exampleFiles = Config::getFilesHere(fullPath, exampleNameFilter, Location(), excludeDirs, excludeFiles); - QString imagesPath = fullPath + "/images"; - QStringList imageFiles = Config::getFilesHere(imagesPath, exampleImageFilter, Location(), excludeDirs, excludeFiles); + // Search for all image files under the example project, excluding doc/images directory. + QSet<QString> excludeDocDirs(excludeDirs); + excludeDocDirs.insert(QDir(fullPath).canonicalPath() + "/doc/images"); + QStringList imageFiles = Config::getFilesHere(fullPath, exampleImageFilter, Location(), excludeDocDirs, excludeFiles); if (!exampleFiles.isEmpty()) { // move main.cpp and to the end, if it exists QString mainCpp; diff --git a/src/qdoc/doc/qdoc-manual-topiccmds.qdoc b/src/qdoc/doc/qdoc-manual-topiccmds.qdoc index 9fd97457d200792bf20a4fc8cbec4efe5c3e9e70..53fe8568418c79276e29c200d2f58233ef9db903 100644 --- a/src/qdoc/doc/qdoc-manual-topiccmds.qdoc +++ b/src/qdoc/doc/qdoc-manual-topiccmds.qdoc @@ -360,13 +360,13 @@ \section1 \\example The \\example command is for documenting an example. The argument - is the example's path relative to omne of the paths listed in the + is the example's path relative to one of the paths listed in the \l {exampledirs-variable} {exampledirs} variable in the QDoc configuration file. - The documentation page will be output to \c {path-to-example}.html. - QDoc will add a list of all the example's source files at the top - of the page. + The documentation page will be output to \c {modulename-path-to-example}.html. + QDoc will add a list of all the example's source and images files at the end + of the page, unless \l {noautolist-command}{\\noautolist} command is used. For example, if \l {exampledirs-variable} {exampledirs} contains \c $QTDIR/examples/widgets/imageviewer, then @@ -391,6 +391,9 @@ <center><h1>Image Viewer Example</h1></center> \endraw + The example shows how to combine QLabel and QScrollArea + to display an image. + Files: \list \li \l{http://doc.qt.io/qt-5/qtwidgets-widgets-imageviewer-imageviewer-cpp.html} @@ -401,12 +404,13 @@ {widgets/imageviewer/main.cpp} \endlist - The example shows how to combine QLabel and QScrollArea - to display an image. ... \endquotation + \b {See also:} \l {generatelist-command}{\\generatelist examplefiles}, + \l {noautolist-command}{\\noautolist} + \target externalpage-command \section1 \\externalpage diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp index 10199d7df492059d0966600f238c492c3298a6a6..a0f8eacde9422db747691ffd1d3531482ec0111c 100644 --- a/src/qdoc/htmlgenerator.cpp +++ b/src/qdoc/htmlgenerator.cpp @@ -713,8 +713,11 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark atom->string().startsWith("exampleimages")) { if (relative->isExample()) { Node::DocSubtype subType = (atom->string().mid(7,5) == "image") ? Node::Image : Node::File; - generateFileList(static_cast<const DocumentNode*>(relative), marker, subType, - atom->string().mid(atom->string().indexOf(" ")).trimmed()); + QString regExp; + int secondArg = atom->string().indexOf(" "); + if (secondArg != -1) + regExp = atom->string().mid(++secondArg); + generateFileList(static_cast<const DocumentNode*>(relative), marker, subType, regExp); } else relative->location().warning(QString("'\\generatelist \1' can only be used with '\\example' topic command").arg(atom->string()));