diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index 241fcbba43..46fb6e27e6 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -3698,7 +3698,7 @@ QString DitaXmlGenerator::guidForNode(const Node* node) Constructs a file name appropriate for the \a node and returns it. If the \a node is not a fake node, or if it is a fake node but it is neither an external page node nor an image node or a ditamap, - call the PageGenerator::fileName() function. + call the Generator::fileName() function. */ QString DitaXmlGenerator::fileName(const Node* node) { diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index f8d4910c28..5583600bf6 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -358,6 +358,11 @@ QString Generator::fileBase(const Node *node) const if (node->subType() == Node::Module) { base.append("-module"); } + if (node->isExample() || node->isExampleFile()) + base.prepend(project.toLower() + QLatin1Char('-')); + if (node->isExample()) + base.append(QLatin1String("-example")); + } // the code below is effectively equivalent to: diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h index 9c8950d185..8364fac82f 100644 --- a/src/tools/qdoc/node.h +++ b/src/tools/qdoc/node.h @@ -193,6 +193,8 @@ public: void markNotSeen() { seen_ = false; } virtual bool isInnerNode() const = 0; + virtual bool isExample() const { return false; } + virtual bool isExampleFile() const { return false; } virtual bool isLeaf() const { return false; } virtual bool isReimp() const { return false; } virtual bool isFunction() const { return false; } @@ -510,6 +512,8 @@ public: virtual QString nameForLists() const { return title(); } virtual void setImageFileName(const QString& ) { } virtual bool isGroup() const { return (subType() == Node::Group); } + virtual bool isExample() const { return (subType() == Node::Example); } + virtual bool isExampleFile() const { return (parent() && parent()->isExample()); } protected: SubType nodeSubtype_;