summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2010-12-09 18:39:35 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2010-12-09 18:39:35 (GMT)
commit297da17b94df6cd4a3b0c4ade56baf55310939e8 (patch)
treeec833849a8b65732d42c86f383537f500cd535ec /tools/qdoc3
parent77f069df4dcfd40a3d009f40e074ce1a5ac132c1 (diff)
downloadQt-297da17b94df6cd4a3b0c4ade56baf55310939e8.zip
Qt-297da17b94df6cd4a3b0c4ade56baf55310939e8.tar.gz
Qt-297da17b94df6cd4a3b0c4ade56baf55310939e8.tar.bz2
Ensured that object definition identifiers are marked up as links.
It may be worthwhile extending this to other UiQualifiedId nodes.
Diffstat (limited to 'tools/qdoc3')
-rw-r--r--tools/qdoc3/qmlmarkupvisitor.cpp14
-rw-r--r--tools/qdoc3/qmlmarkupvisitor.h3
2 files changed, 13 insertions, 4 deletions
diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp
index 6bede96..9916be2 100644
--- a/tools/qdoc3/qmlmarkupvisitor.cpp
+++ b/tools/qdoc3/qmlmarkupvisitor.cpp
@@ -183,7 +183,8 @@ void QmlMarkupVisitor::addExtra(quint32 start, quint32 finish)
}
void QmlMarkupVisitor::addMarkedUpToken(
- QDeclarativeJS::AST::SourceLocation &location, const QString &tagName)
+ QDeclarativeJS::AST::SourceLocation &location, const QString &tagName,
+ const QHash<QString, QString> &attributes)
{
if (!location.isValid())
return;
@@ -193,7 +194,10 @@ void QmlMarkupVisitor::addMarkedUpToken(
else if (cursor > location.offset)
return;
- output += QString(QLatin1String("<@%1>%2</@%3>")).arg(tagName, protect(sourceText(location)), tagName);
+ output += QString(QLatin1String("<@%1")).arg(tagName);
+ foreach (const QString &key, attributes)
+ output += QString(QLatin1String(" %1=\"%2\"")).arg(key).arg(attributes[key]);
+ output += QString(QLatin1String(">%2</@%3>")).arg(protect(sourceText(location)), tagName);
cursor += location.length;
}
@@ -853,9 +857,13 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement)
return true;
}
+// Elements and items are represented by UiObjectDefinition nodes.
+
bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition)
{
- QDeclarativeJS::AST::Node::accept(definition->qualifiedTypeNameId, this);
+ QHash<QString, QString> attributes;
+ attributes[QLatin1String("node")] = sourceText(definition->qualifiedTypeNameId->identifierToken);
+ addMarkedUpToken(definition->qualifiedTypeNameId->identifierToken, QLatin1String("link"), attributes);
QDeclarativeJS::AST::Node::accept(definition->initializer, this);
return false;
}
diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h
index 7a9ff22..60bc336 100644
--- a/tools/qdoc3/qmlmarkupvisitor.h
+++ b/tools/qdoc3/qmlmarkupvisitor.h
@@ -161,7 +161,8 @@ protected:
private:
void addExtra(quint32 start, quint32 finish);
void addMarkedUpToken(QDeclarativeJS::AST::SourceLocation &location,
- const QString &text);
+ const QString &text,
+ const QHash<QString, QString> &attributes = QHash<QString, QString>());
void addVerbatim(QDeclarativeJS::AST::SourceLocation first,
QDeclarativeJS::AST::SourceLocation last = QDeclarativeJS::AST::SourceLocation());
QString sourceText(QDeclarativeJS::AST::SourceLocation &location);