summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/qdoc3/helpprojectwriter.cpp61
-rw-r--r--tools/qdoc3/htmlgenerator.cpp2
-rw-r--r--tools/qdoc3/node.h8
-rw-r--r--tools/qdoc3/tree.cpp78
4 files changed, 126 insertions, 23 deletions
diff --git a/tools/qdoc3/helpprojectwriter.cpp b/tools/qdoc3/helpprojectwriter.cpp
index 71810e4..edba097 100644
--- a/tools/qdoc3/helpprojectwriter.cpp
+++ b/tools/qdoc3/helpprojectwriter.cpp
@@ -41,6 +41,7 @@
#include <QHash>
#include <QMap>
+#include <qdebug.h>
#include "atom.h"
#include "helpprojectwriter.h"
@@ -116,6 +117,11 @@ void HelpProjectWriter::readSelectors(SubProject &subproject, const QStringList
typeHash["property"] = Node::Property;
typeHash["variable"] = Node::Variable;
typeHash["target"] = Node::Target;
+#ifdef QDOC_QML
+ typeHash["qmlproperty"] = Node::QmlProperty;
+ typeHash["qmlsignal"] = Node::QmlSignal;
+ typeHash["qmlmethod"] = Node::QmlMethod;
+#endif
QHash<QString, Node::SubType> subTypeHash;
subTypeHash["example"] = Node::Example;
@@ -127,6 +133,8 @@ void HelpProjectWriter::readSelectors(SubProject &subproject, const QStringList
subTypeHash["externalpage"] = Node::ExternalPage;
#ifdef QDOC_QML
subTypeHash["qmlclass"] = Node::QmlClass;
+ subTypeHash["qmlpropertygroup"] = Node::QmlPropertyGroup;
+ subTypeHash["qmlbasictype"] = Node::QmlBasicType;
#endif
QSet<Node::SubType> allSubTypes = QSet<Node::SubType>::fromList(subTypeHash.values());
@@ -176,7 +184,13 @@ QStringList HelpProjectWriter::keywordDetails(const Node *node) const
{
QStringList details;
- if (node->parent() && !node->parent()->name().isEmpty()) {
+ if (node->type() == Node::QmlProperty) {
+ // "name"
+ details << node->name();
+ // "id"
+ details << node->parent()->parent()->name()+"::"+node->name();
+ }
+ else if (node->parent() && !node->parent()->name().isEmpty()) {
// "name"
if (node->type() == Node::Enum || node->type() == Node::Typedef)
details << node->parent()->name()+"::"+node->name();
@@ -184,29 +198,29 @@ QStringList HelpProjectWriter::keywordDetails(const Node *node) const
details << node->name();
// "id"
details << node->parent()->name()+"::"+node->name();
- } else if (node->type() == Node::Fake) {
+ }
+ else if (node->type() == Node::Fake) {
const FakeNode *fake = static_cast<const FakeNode *>(node);
-#ifdef QDOC_QML
if (fake->subType() == Node::QmlClass) {
details << (QmlClassNode::qmlOnly ? fake->name() : fake->fullTitle());
details << "QML." + fake->name();
- } else
-#endif
- {
+ }
+ else {
details << fake->fullTitle();
details << fake->fullTitle();
}
- } else {
+ }
+ else {
details << node->name();
details << node->name();
}
details << tree->fullDocumentLocation(node);
-
return details;
}
bool HelpProjectWriter::generateSection(HelpProject &project,
- QXmlStreamWriter & /* writer */, const Node *node)
+ QXmlStreamWriter & /* writer */,
+ const Node *node)
{
if (!node->url().isEmpty())
return false;
@@ -225,9 +239,10 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
if (node->type() == Node::Fake) {
const FakeNode *fake = static_cast<const FakeNode *>(node);
objName = fake->fullTitle();
- } else
+ }
+ else
objName = tree->fullDocumentName(node);
-
+
// Only add nodes to the set for each subproject if they match a selector.
// Those that match will be listed in the table of contents.
@@ -289,6 +304,9 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
break;
case Node::Property:
+ case Node::QmlProperty:
+ case Node::QmlSignal:
+ case Node::QmlMethod:
project.keywords.append(keywordDetails(node));
break;
@@ -399,7 +417,7 @@ void HelpProjectWriter::generateSections(HelpProject &project,
{
if (!generateSection(project, writer, node))
return;
-
+
if (node->isInnerNode()) {
const InnerNode *inner = static_cast<const InnerNode *>(node);
@@ -408,8 +426,23 @@ void HelpProjectWriter::generateSections(HelpProject &project,
foreach (const Node *node, inner->childNodes()) {
if (node->access() == Node::Private)
continue;
- if (node->type() == Node::Fake)
- childMap[static_cast<const FakeNode *>(node)->fullTitle()] = node;
+ if (node->type() == Node::Fake) {
+ /*
+ Don't visit QML property group nodes,
+ but visit their children, which are all
+ QML property nodes.
+ */
+ if (node->subType() == Node::QmlPropertyGroup) {
+ const InnerNode* inner = static_cast<const InnerNode*>(node);
+ foreach (const Node* n, inner->childNodes()) {
+ if (n->access() == Node::Private)
+ continue;
+ childMap[tree->fullDocumentName(n)] = n;
+ }
+ }
+ else
+ childMap[static_cast<const FakeNode *>(node)->fullTitle()] = node;
+ }
else {
if (node->type() == Node::Function) {
const FunctionNode *funcNode = static_cast<const FunctionNode *>(node);
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index c1e3678..cd3da3e 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -405,7 +405,9 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker)
generateIndex(fileBase, projectUrl, projectDescription);
generatePageIndex(outputDir() + "/" + fileBase + ".pageindex", marker);
+ //qDebug() << "start helpProjectWriter->generate(myTree)";
helpProjectWriter->generate(myTree);
+ //qDebug() << "end helpProjectWriter->generate(myTree)";
}
void HtmlGenerator::startText(const Node * /* relative */,
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index 1017813..215a7ae 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -163,6 +163,7 @@ class Node
virtual bool isInnerNode() const = 0;
virtual bool isReimp() const { return false; }
virtual bool isFunction() const { return false; }
+ virtual bool isQmlNode() const { return false; }
Type type() const { return typ; }
virtual SubType subType() const { return NoSubType; }
InnerNode *parent() const { return par; }
@@ -380,6 +381,7 @@ class QmlClassNode : public FakeNode
const QString& name,
const ClassNode* cn);
virtual ~QmlClassNode();
+ virtual bool isQmlNode() const { return true; }
const ClassNode* classNode() const { return cnode; }
virtual QString fileBase() const;
@@ -401,6 +403,7 @@ class QmlBasicTypeNode : public FakeNode
QmlBasicTypeNode(InnerNode *parent,
const QString& name);
virtual ~QmlBasicTypeNode() { }
+ virtual bool isQmlNode() const { return true; }
};
class QmlPropGroupNode : public FakeNode
@@ -410,6 +413,7 @@ class QmlPropGroupNode : public FakeNode
const QString& name,
bool attached);
virtual ~QmlPropGroupNode() { }
+ virtual bool isQmlNode() const { return true; }
const QString& element() const { return parent()->name(); }
void setDefault() { isdefault = true; }
@@ -441,6 +445,7 @@ class QmlPropertyNode : public LeafNode
bool isDesignable() const { return fromTrool(des,false); }
bool isWritable() const { return fromTrool(wri,true); }
bool isAttached() const { return att; }
+ virtual bool isQmlNode() const { return true; }
const QString& element() const { return static_cast<QmlPropGroupNode*>(parent())->element(); }
@@ -609,6 +614,9 @@ class FunctionNode : public LeafNode
QString signature(bool values = false) const;
const QString& element() const { return parent()->name(); }
bool isAttached() const { return att; }
+ virtual bool isQmlNode() const {
+ return ((type() == QmlSignal) || (type() == QmlMethod));
+ }
void debug() const;
diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp
index 7dcc8c3..31bbf54 100644
--- a/tools/qdoc3/tree.cpp
+++ b/tools/qdoc3/tree.cpp
@@ -1121,6 +1121,15 @@ bool Tree::generateIndexSection(QXmlStreamWriter &writer,
case Node::Target:
nodeName = "target";
break;
+ case Node::QmlProperty:
+ nodeName = "qmlproperty";
+ break;
+ case Node::QmlSignal:
+ nodeName = "qmlsignal";
+ break;
+ case Node::QmlMethod:
+ nodeName = "qmlmethod";
+ break;
default:
return false;
}
@@ -1210,7 +1219,7 @@ bool Tree::generateIndexSection(QXmlStreamWriter &writer,
if (fullName != objName)
writer.writeAttribute("fullname", fullName);
writer.writeAttribute("href", fullDocumentLocation(node));
- if (node->type() != Node::Fake)
+ if ((node->type() != Node::Fake) && (!node->isQmlNode()))
writer.writeAttribute("location", node->location().fileName());
switch (node->type()) {
@@ -1265,6 +1274,12 @@ bool Tree::generateIndexSection(QXmlStreamWriter &writer,
case Node::ExternalPage:
writer.writeAttribute("subtype", "externalpage");
break;
+ case Node::QmlClass:
+ writer.writeAttribute("subtype", "qmlclass");
+ break;
+ case Node::QmlBasicType:
+ writer.writeAttribute("subtype", "qmlbasictype");
+ break;
default:
break;
}
@@ -1337,6 +1352,12 @@ bool Tree::generateIndexSection(QXmlStreamWriter &writer,
}
break;
+ case Node::QmlProperty:
+ {
+ const QmlPropertyNode *qpn = static_cast<const QmlPropertyNode*>(node);
+ writer.writeAttribute("type", qpn->dataType());
+ }
+ break;
case Node::Property:
{
const PropertyNode *propertyNode = static_cast<const PropertyNode*>(node);
@@ -1524,9 +1545,22 @@ void Tree::generateIndexSections(QXmlStreamWriter &writer,
if (node->isInnerNode()) {
const InnerNode *inner = static_cast<const InnerNode *>(node);
- // Recurse to write an element for this child node and all its children.
- foreach (const Node *child, inner->childNodes())
- generateIndexSections(writer, child, generateInternalNodes);
+ foreach (const Node *child, inner->childNodes()) {
+ /*
+ Don't generate anything for a QML property group node.
+ It is just a place holder for a collection of QML property
+ nodes. Recurse to its children, which are the QML property
+ nodes.
+ */
+ if (child->subType() == Node::QmlPropertyGroup) {
+ const InnerNode *pgn = static_cast<const InnerNode*>(child);
+ foreach (const Node *c, pgn->childNodes()) {
+ generateIndexSections(writer, c, generateInternalNodes);
+ }
+ }
+ else
+ generateIndexSections(writer, child, generateInternalNodes);
+ }
/*
foreach (const Node *child, inner->relatedNodes()) {
@@ -1931,9 +1965,23 @@ QString Tree::fullDocumentLocation(const Node *node) const
if ((parentNode = node->relates()))
parentName = fullDocumentLocation(node->relates());
- else if ((parentNode = node->parent()))
- parentName = fullDocumentLocation(node->parent());
-
+ else if ((parentNode = node->parent())) {
+ if (parentNode->subType() == Node::QmlPropertyGroup) {
+ parentNode = parentNode->parent();
+ parentName = "qml-" + parentNode->fileBase() + ".html";
+ }
+ else
+ parentName = fullDocumentLocation(node->parent());
+ }
+#if 0
+ if (node->type() == Node::QmlProperty) {
+ qDebug() << "Node::QmlProperty:" << node->name()
+ << "parentName:" << parentName;
+ if (parentNode)
+ qDebug() << "PARENT NODE" << parentNode->type()
+ << parentNode->subType() << parentNode->name();
+ }
+#endif
switch (node->type()) {
case Node::Class:
case Node::Namespace:
@@ -1980,6 +2028,15 @@ QString Tree::fullDocumentLocation(const Node *node) const
case Node::Property:
anchorRef = "#" + node->name() + "-prop";
break;
+ case Node::QmlProperty:
+ anchorRef = "#" + node->name() + "-prop";
+ break;
+ case Node::QmlSignal:
+ anchorRef = "#" + node->name() + "-signal";
+ break;
+ case Node::QmlMethod:
+ anchorRef = "#" + node->name() + "-method";
+ break;
case Node::Variable:
anchorRef = "#" + node->name() + "-var";
break;
@@ -2019,6 +2076,8 @@ QString Tree::fullDocumentLocation(const Node *node) const
}
/*!
+ Construct the full document name for \a node and return the
+ name.
*/
QString Tree::fullDocumentName(const Node *node) const
{
@@ -2029,10 +2088,11 @@ QString Tree::fullDocumentName(const Node *node) const
const Node *n = node;
do {
- if (!n->name().isEmpty())
+ if (!n->name().isEmpty() &&
+ ((n->type() != Node::Fake) || (n->subType() != Node::QmlPropertyGroup)))
pieces.insert(0, n->name());
- if (n->type() == Node::Fake)
+ if ((n->type() == Node::Fake) && (n->subType() != Node::QmlPropertyGroup))
break;
// Examine the parent node if one exists.