diff options
-rw-r--r-- | tools/qdoc3/cppcodeparser.cpp | 13 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 46 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.h | 1 | ||||
-rw-r--r-- | tools/qdoc3/node.cpp | 20 | ||||
-rw-r--r-- | tools/qdoc3/node.h | 6 |
5 files changed, 76 insertions, 10 deletions
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index c8655a4..021d64a 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -1033,7 +1033,10 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc, #ifdef QDOC_QML else if (command == COMMAND_QMLINHERITS) { setLink(node, Node::InheritsLink, arg); - } + if (node->subType() == Node::QmlClass) { + QmlClassNode::addInheritedBy(arg,node->name()); + } + } else if (command == COMMAND_QMLDEFAULT) { QmlPropGroupNode* qpgn = static_cast<QmlPropGroupNode*>(node); qpgn->setDefault(); @@ -2299,14 +2302,6 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake) QString imagesPath = fullPath + "/images"; QStringList imageFiles = Config::getFilesHere(imagesPath,exampleImageFilter); -#if 0 - qDebug() << "examplePath:" << examplePath; - qDebug() << " exampleFiles" << exampleFiles; - qDebug() << "imagesPath:" << imagesPath; - qDebug() << "fullPath:" << fullPath; - qDebug() << " imageFiles" << imageFiles; -#endif - if (!exampleFiles.isEmpty()) { // move main.cpp and to the end, if it exists QString mainCpp; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index e341a03..01e79dd 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1525,6 +1525,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateQmlInherits(qml_cn, marker); generateQmlInstantiates(qml_cn, marker); generateBrief(qml_cn, marker); + generateQmlInheritedBy(qml_cn, marker); sections = marker->qmlSections(qml_cn,CodeMarker::Summary); s = sections.begin(); while (s != sections.end()) { @@ -4309,6 +4310,51 @@ void HtmlGenerator::generateQmlInherits(const QmlClassNode* cn, } /*! + Output the "Inherit by" list for the QML element, + if it is inherited by any other elements. + */ +void HtmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn, + CodeMarker* marker) +{ + if (cn) { + QStringList subs; + QmlClassNode::subclasses(cn->name(),subs); + if (!subs.isEmpty()) { + subs.sort(); + Text text; + text << Atom::ParaLeft << "Inherited by "; + for (int i = 0; i < subs.size(); ++i) { + text << subs.at(i); + text << separator(i, subs.size()); + } + text << Atom::ParaRight; + generateText(text, cn, marker); + } +#if 0 + if (cn->links().contains(Node::InheritsLink)) { + QPair<QString,QString> linkPair; + linkPair = cn->links()[Node::InheritsLink]; + QStringList strList(linkPair.first); + const Node* n = myTree->findNode(strList,Node::Fake); + if (n && n->subType() == Node::QmlClass) { + const QmlClassNode* qcn = static_cast<const QmlClassNode*>(n); + out() << "<p style=\"text-align: center\">"; + Text text; + text << "[Inherits "; + text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); + text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK); + text << Atom(Atom::String, linkPair.second); + text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); + text << "]"; + generateText(text, cn, marker); + out() << "</p>"; + } + } +#endif + } +} + +/*! Output the "[Xxx instantiates the C++ class QmlGraphicsXxx]" line for the QML element, if there should be one. diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 369d6c3..551bead 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -185,6 +185,7 @@ class HtmlGenerator : public PageGenerator const InnerNode *relative, CodeMarker *marker); void generateQmlInherits(const QmlClassNode* cn, CodeMarker* marker); + void generateQmlInheritedBy(const QmlClassNode* cn, CodeMarker* marker); void generateQmlInstantiates(const QmlClassNode* qcn, CodeMarker* marker); void generateInstantiatedBy(const ClassNode* cn, CodeMarker* marker); #endif diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index ec574f8..4ddcfb1 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1257,6 +1257,7 @@ bool TargetNode::isInnerNode() const #ifdef QDOC_QML bool QmlClassNode::qmlOnly = false; +QMultiMap<QString,QString> QmlClassNode::inheritedBy; /*! Constructs a Qml class node (i.e. a Fake node with the @@ -1290,6 +1291,25 @@ QString QmlClassNode::fileBase() const } /*! + Record the fact that QML class \a base is inherited by + QML class \a sub. + */ +void QmlClassNode::addInheritedBy(const QString& base, const QString& sub) +{ + inheritedBy.insert(base,sub); +} + +/*! + Loads the list \a subs with the names of all the subclasses of \a base. + */ +void QmlClassNode::subclasses(const QString& base, QStringList& subs) +{ + subs.clear(); + if (inheritedBy.contains(base)) + subs = inheritedBy.values(base); +} + +/*! Constructs a Qml basic type node (i.e. a Fake node with the subtype QmlBasicType. The new node has the given \a parent and \a name. diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 021a052..de26025 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -383,11 +383,15 @@ class QmlClassNode : public FakeNode const ClassNode* classNode() const { return cnode; } virtual QString fileBase() const; + static void addInheritedBy(const QString& base, const QString& sub); + static void subclasses(const QString& base, QStringList& subs); + public: static bool qmlOnly; + static QMultiMap<QString,QString> inheritedBy; private: - const ClassNode* cnode; + const ClassNode* cnode; }; class QmlBasicTypeNode : public FakeNode |