diff options
author | Martin Smith <martin.smith@nokia.com> | 2010-08-11 09:29:07 (GMT) |
---|---|---|
committer | Jesper Thomschutz <jesper.thomschutz@nokia.com> | 2010-08-12 08:52:16 (GMT) |
commit | fe131fca53545c45cbddf436400921f2e0f03bad (patch) | |
tree | 94bcaec60be9076527dfaabf4c6827c311d677d8 | |
parent | 1a378511576b32ec26dcbd85b66a94e366422d61 (diff) | |
download | Qt-fe131fca53545c45cbddf436400921f2e0f03bad.zip Qt-fe131fca53545c45cbddf436400921f2e0f03bad.tar.gz Qt-fe131fca53545c45cbddf436400921f2e0f03bad.tar.bz2 |
qdoc: Added list of all members (including inherited) page to QML elements.
(cherry picked from commit 62968f33452016b31020e524fa6ba6d2cefd0278)
-rw-r--r-- | tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml | 30 | ||||
-rw-r--r-- | tools/qdoc3/codemarker.cpp | 4 | ||||
-rw-r--r-- | tools/qdoc3/codemarker.h | 3 | ||||
-rw-r--r-- | tools/qdoc3/cppcodemarker.cpp | 45 | ||||
-rw-r--r-- | tools/qdoc3/cppcodemarker.h | 3 | ||||
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.cpp | 4 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 43 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.h | 5 |
8 files changed, 113 insertions, 24 deletions
diff --git a/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml index f19ab4f..54b5b68 100644 --- a/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml @@ -1,15 +1,15 @@ -import Qt 4.7
-
-Rectangle {
- width: 300
- height: 300
-
- Rectangle {
- height: childrenRect.height
-
- Repeater {
- model: 1
- Rectangle { }
- }
- }
-}
+import Qt 4.7 + +Rectangle { + width: 300 + height: 300 + + Rectangle { + height: childrenRect.height + + Repeater { + model: 1 + Rectangle { } + } + } +} diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp index 7130d61..ec86ae3 100644 --- a/tools/qdoc3/codemarker.cpp +++ b/tools/qdoc3/codemarker.cpp @@ -624,7 +624,9 @@ QString CodeMarker::macName(const Node *node, const QString &name) Get the list of documentation sections for the children of the specified QmlClassNode. */ -QList<Section> CodeMarker::qmlSections(const QmlClassNode* , SynopsisStyle ) +QList<Section> CodeMarker::qmlSections(const QmlClassNode* , + SynopsisStyle , + const Tree* ) { return QList<Section>(); } diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h index 53ad4a8..f17b28e 100644 --- a/tools/qdoc3/codemarker.h +++ b/tools/qdoc3/codemarker.h @@ -153,7 +153,8 @@ class CodeMarker Status status) = 0; #ifdef QDOC_QML virtual QList<Section> qmlSections(const QmlClassNode* qmlClassNode, - SynopsisStyle style); + SynopsisStyle style, + const Tree* tree); #endif virtual const Node* resolveTarget(const QString& target, const Tree* tree, diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 562e92b..3615a84 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -1127,7 +1127,8 @@ QString CppCodeMarker::addMarkUp(const QString& protectedCode, Currently, it only handles QML property groups. */ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, - SynopsisStyle style) + SynopsisStyle style, + const Tree* tree) { QList<Section> sections; if (qmlClassNode) { @@ -1244,6 +1245,48 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, append(sections,qmlmethods); append(sections,qmlattachedmethods); } + else { + FastSection all(qmlClassNode,"","","member","members"); + + QStack<const QmlClassNode*> stack; + stack.push(qmlClassNode); + + while (!stack.isEmpty()) { + const QmlClassNode* ancestorClass = stack.pop(); + + NodeList::ConstIterator c = ancestorClass->childNodes().begin(); + while (c != ancestorClass->childNodes().end()) { + // if ((*c)->access() != Node::Private) + if ((*c)->subType() == Node::QmlPropertyGroup) { + const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(*c); + NodeList::ConstIterator p = qpgn->childNodes().begin(); + while (p != qpgn->childNodes().end()) { + if ((*p)->type() == Node::QmlProperty) { + insert(all,*p,style,Okay); + } + ++p; + } + } + else + insert(all,*c,style,Okay); + ++c; + } + + if (!ancestorClass->links().empty()) { + if (ancestorClass->links().contains(Node::InheritsLink)) { + QPair<QString,QString> linkPair; + linkPair = ancestorClass->links()[Node::InheritsLink]; + QStringList strList(linkPair.first); + const Node* n = tree->findNode(strList,Node::Fake); + if (n && n->subType() == Node::QmlClass) { + const QmlClassNode* qcn = static_cast<const QmlClassNode*>(n); + stack.prepend(qcn); + } + } + } + } + append(sections, all); + } } return sections; diff --git a/tools/qdoc3/cppcodemarker.h b/tools/qdoc3/cppcodemarker.h index eca3936..804a302 100644 --- a/tools/qdoc3/cppcodemarker.h +++ b/tools/qdoc3/cppcodemarker.h @@ -80,7 +80,8 @@ class CppCodeMarker : public CodeMarker SynopsisStyle style, Status status); QList<Section> qmlSections(const QmlClassNode* qmlClassNode, - SynopsisStyle style); + SynopsisStyle style, + const Tree* tree); const Node* resolveTarget(const QString& target, const Tree* tree, const Node* relative, diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 816ab9f..7892025 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1764,7 +1764,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker generateQmlInstantiates(qml_cn, marker); generateBrief(qml_cn, marker); generateQmlInheritedBy(qml_cn, marker); - sections = marker->qmlSections(qml_cn,CodeMarker::Summary); + sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); s = sections.begin(); while (s != sections.end()) { out() << "<a name=\"" << registerRef((*s).name) << "\"></a>\n"; @@ -1781,7 +1781,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker generateAlsoList(fake, marker); out() << "<hr />\n"; - sections = marker->qmlSections(qml_cn,CodeMarker::Detailed); + sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0); s = sections.begin(); while (s != sections.end()) { out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index b0c3150..198745b 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1493,7 +1493,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) const QmlClassNode* qml_cn = 0; if (fake->subType() == Node::QmlClass) { qml_cn = static_cast<const QmlClassNode*>(fake); - sections = marker->qmlSections(qml_cn,CodeMarker::Summary); + sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); generateTableOfContents(fake,marker,§ions); } else if (fake->name() != QString("index.html")) @@ -1575,6 +1575,13 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateQmlInherits(qml_cn, marker); generateQmlInheritedBy(qml_cn, marker); generateQmlInstantiates(qml_cn, marker); + + QString allQmlMembersLink = generateAllQmlMembersFile(qml_cn, marker); + if (!allQmlMembersLink.isEmpty()) { + out() << "<li><a href=\"" << allQmlMembersLink << "\">" + << "List of all members, including inherited members</a></li>\n"; + } + s = sections.begin(); while (s != sections.end()) { out() << "<a name=\"" << registerRef((*s).name.toLower()) @@ -1594,7 +1601,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateExtractionMark(fake, EndMark); //out() << "<hr />\n"; - sections = marker->qmlSections(qml_cn,CodeMarker::Detailed); + sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0); s = sections.begin(); while (s != sections.end()) { out() << "<h2>" << protectEnc((*s).name) << "</h2>\n"; @@ -2346,6 +2353,38 @@ QString HtmlGenerator::generateListOfAllMemberFile(const InnerNode *inner, return fileName; } +/*! + This function creates an html page on which are listed all + the members of QML class \a qml_cn, including the inherited + members. The \a marker is used for formatting stuff. + */ +QString HtmlGenerator::generateAllQmlMembersFile(const QmlClassNode* qml_cn, + CodeMarker* marker) +{ + QList<Section> sections; + QList<Section>::ConstIterator s; + + sections = marker->qmlSections(qml_cn,CodeMarker::SeparateList,myTree); + if (sections.isEmpty()) + return QString(); + + QString fileName = fileBase(qml_cn) + "-members." + fileExtension(qml_cn); + beginSubPage(qml_cn->location(), fileName); + QString title = "List of All Members for " + qml_cn->name(); + generateHeader(title, qml_cn, marker); + generateTitle(title, Text(), SmallSubTitle, qml_cn, marker); + out() << "<p>This is the complete list of members for "; + generateFullName(qml_cn, 0, marker); + out() << ", including inherited members.</p>\n"; + + Section section = sections.first(); + generateSectionList(section, 0, marker, CodeMarker::SeparateList); + + generateFooter(); + endSubPage(); + return fileName; +} + QString HtmlGenerator::generateLowStatusMemberFile(const InnerNode *inner, CodeMarker *marker, CodeMarker::Status status) diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index ec79896..07226f5 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -169,7 +169,10 @@ class HtmlGenerator : public PageGenerator void generateTableOfContents(const Node *node, CodeMarker *marker, QList<Section>* sections = 0); - QString generateListOfAllMemberFile(const InnerNode *inner, CodeMarker *marker); + QString generateListOfAllMemberFile(const InnerNode *inner, + CodeMarker *marker); + QString generateAllQmlMembersFile(const QmlClassNode* qml_cn, + CodeMarker* marker); QString generateLowStatusMemberFile(const InnerNode *inner, CodeMarker *marker, CodeMarker::Status status); |