summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2010-02-19 11:35:50 (GMT)
committerMartin Smith <msmith@trolltech.com>2010-02-19 11:35:50 (GMT)
commit83d7242271cf8196a8133de0406788135e16abbb (patch)
tree7c1c8e88ff871e8d5df2c4aef5c696e2fe938215 /tools/qdoc3
parent5c247a8afb51ff58c4f0ef7f26c2e22d4700cd39 (diff)
downloadQt-83d7242271cf8196a8133de0406788135e16abbb.zip
Qt-83d7242271cf8196a8133de0406788135e16abbb.tar.gz
Qt-83d7242271cf8196a8133de0406788135e16abbb.tar.bz2
qdoc: Finished "Inherited by" list for QML elements.
The listed elements are now links. Task: QTBUG-8153
Diffstat (limited to 'tools/qdoc3')
-rw-r--r--tools/qdoc3/cppcodeparser.cpp2
-rw-r--r--tools/qdoc3/generator.cpp26
-rw-r--r--tools/qdoc3/generator.h7
-rw-r--r--tools/qdoc3/htmlgenerator.cpp30
-rw-r--r--tools/qdoc3/node.cpp8
-rw-r--r--tools/qdoc3/node.h6
6 files changed, 44 insertions, 35 deletions
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index 021d64a..d9e9c3b 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -1034,7 +1034,7 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc,
else if (command == COMMAND_QMLINHERITS) {
setLink(node, Node::InheritsLink, arg);
if (node->subType() == Node::QmlClass) {
- QmlClassNode::addInheritedBy(arg,node->name());
+ QmlClassNode::addInheritedBy(arg,node);
}
}
else if (command == COMMAND_QMLDEFAULT) {
diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp
index 9b58d7f..d092f86 100644
--- a/tools/qdoc3/generator.cpp
+++ b/tools/qdoc3/generator.cpp
@@ -1213,6 +1213,32 @@ void Generator::appendSortedNames(Text& text,
}
}
+void Generator::appendSortedNames(Text& text,
+ const Node* base,
+ const NodeList& subs,
+ CodeMarker *marker)
+{
+ NodeList::ConstIterator r;
+ QMap<QString,Text> classMap;
+ int index = 0;
+
+ r = subs.begin();
+ while (r != subs.end()) {
+ Text className;
+ appendFullName(className, (*r), base, marker);
+ classMap[className.toString().toLower()] = className;
+ ++r;
+ }
+
+ QStringList classNames = classMap.keys();
+ classNames.sort();
+
+ foreach (const QString &className, classNames) {
+ text << classMap[className];
+ text << separator(index++, classNames.count());
+ }
+}
+
int Generator::skipAtoms(const Atom *atom, Atom::Type type) const
{
int skipAhead = 0;
diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h
index 06f7f88..77dcfd4 100644
--- a/tools/qdoc3/generator.h
+++ b/tools/qdoc3/generator.h
@@ -170,6 +170,13 @@ class Generator
const QList<RelatedClass> &classes,
CodeMarker *marker);
+ protected:
+ void appendSortedNames(Text& text,
+ const Node* base,
+ const NodeList& subs,
+ CodeMarker *marker);
+
+ private:
QString amp;
QString lt;
QString gt;
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 01e79dd..45da0f1 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -4317,40 +4317,16 @@ void HtmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn,
CodeMarker* marker)
{
if (cn) {
- QStringList subs;
+ NodeList subs;
QmlClassNode::subclasses(cn->name(),subs);
if (!subs.isEmpty()) {
- subs.sort();
+ //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());
- }
+ appendSortedNames(text,cn,subs,marker);
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
}
}
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 4ddcfb1..5357597 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -1257,7 +1257,7 @@ bool TargetNode::isInnerNode() const
#ifdef QDOC_QML
bool QmlClassNode::qmlOnly = false;
-QMultiMap<QString,QString> QmlClassNode::inheritedBy;
+QMultiMap<QString,Node*> QmlClassNode::inheritedBy;
/*!
Constructs a Qml class node (i.e. a Fake node with the
@@ -1294,15 +1294,15 @@ 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)
+void QmlClassNode::addInheritedBy(const QString& base, Node* sub)
{
inheritedBy.insert(base,sub);
}
/*!
- Loads the list \a subs with the names of all the subclasses of \a base.
+ Loads the list \a subs with the nodes of all the subclasses of \a base.
*/
-void QmlClassNode::subclasses(const QString& base, QStringList& subs)
+void QmlClassNode::subclasses(const QString& base, NodeList& subs)
{
subs.clear();
if (inheritedBy.contains(base))
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index de26025..3798e4e 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -383,12 +383,12 @@ 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);
+ static void addInheritedBy(const QString& base, Node* sub);
+ static void subclasses(const QString& base, NodeList& subs);
public:
static bool qmlOnly;
- static QMultiMap<QString,QString> inheritedBy;
+ static QMultiMap<QString,Node*> inheritedBy;
private:
const ClassNode* cnode;