summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@digia.com>2015-01-15 11:52:53 +0100
committerMartin Smith <martin.smith@digia.com>2015-01-17 11:04:40 +0100
commit1bbcad9e5e011dedd7706a10e221a6f442781df9 (patch)
treec78940ea1a4709726ca2ba6af11297e2495ea03e /src/tools/qdoc
parent70ed7c727aebdc7b3b149f95a3900cd60b76d1b1 (diff)
qdoc: Fixed broken links for abstract QML types
When a QML base type is abstract, the documentation for its properties is supposed to appear on the reference page for each QML type that inherits the abstract type. And then links to those properties from within the property documentation must refer to the documentation for that property on the reference page for the particular inheriting QML type. These links were dead, but this fix corrects the problem. Change-Id: Icaf01d67edf44567099f5a6a59fd6348de8df380 Task-number: QTBUG-43200 Reviewed-by: Nico Vertriest <nico.vertriest@digia.com> Reviewed-by: Tero Kojo <tero.kojo@digia.com> Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Diffstat (limited to 'src/tools/qdoc')
-rw-r--r--src/tools/qdoc/generator.cpp1
-rw-r--r--src/tools/qdoc/generator.h3
-rw-r--r--src/tools/qdoc/htmlgenerator.cpp23
3 files changed, 11 insertions, 16 deletions
diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp
index db531e3936..75bfa5033b 100644
--- a/src/tools/qdoc/generator.cpp
+++ b/src/tools/qdoc/generator.cpp
@@ -96,6 +96,7 @@ Generator::QDocPass Generator::qdocPass_ = Generator::Neither;
bool Generator::qdocSingleExec_ = false;
bool Generator::qdocWriteQaPages_ = false;
bool Generator::useOutputSubdirs_ = true;
+QmlClassNode* Generator::qmlTypeContext_ = 0;
void Generator::startDebugging(const QString& message)
{
diff --git a/src/tools/qdoc/generator.h b/src/tools/qdoc/generator.h
index b1faf02ae9..d0c38bcb40 100644
--- a/src/tools/qdoc/generator.h
+++ b/src/tools/qdoc/generator.h
@@ -101,6 +101,8 @@ public:
static QString defaultModuleName() { return project_; }
static void resetUseOutputSubdirs() { useOutputSubdirs_ = false; }
static bool useOutputSubdirs() { return useOutputSubdirs_; }
+ static void setQmlTypeContext(QmlClassNode* t) { qmlTypeContext_ = t; }
+ static QmlClassNode* qmlTypeContext() { return qmlTypeContext_; }
protected:
virtual void beginSubPage(const InnerNode* node, const QString& fileName);
@@ -221,6 +223,7 @@ private:
static bool qdocSingleExec_;
static bool qdocWriteQaPages_;
static bool useOutputSubdirs_;
+ static QmlClassNode* qmlTypeContext_;
void generateReimplementedFrom(const FunctionNode *func, CodeMarker *marker);
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp
index bb1f9cd651..22c44bd7f6 100644
--- a/src/tools/qdoc/htmlgenerator.cpp
+++ b/src/tools/qdoc/htmlgenerator.cpp
@@ -1532,6 +1532,7 @@ void HtmlGenerator::generateClassLikeNode(InnerNode* inner, CodeMarker* marker)
*/
void HtmlGenerator::generateQmlTypePage(QmlClassNode* qcn, CodeMarker* marker)
{
+ Generator::setQmlTypeContext(qcn);
SubTitleSize subTitleSize = LargeSubTitle;
QList<Section>::const_iterator s;
QString htmlTitle = qcn->fullTitle() + " QML Type";
@@ -1595,6 +1596,7 @@ void HtmlGenerator::generateQmlTypePage(QmlClassNode* qcn, CodeMarker* marker)
++s;
}
generateFooter(qcn);
+ Generator::setQmlTypeContext(0);
}
/*!
@@ -3894,8 +3896,9 @@ QString HtmlGenerator::getAutoLink(const Atom *atom, const Node *relative, const
QString ref;
*node = qdb_->findNodeForAtom(atom, relative, ref);
- if (!(*node))
+ if (!(*node)) {
return QString();
+ }
QString link = (*node)->url();
if (link.isEmpty()) {
@@ -3933,21 +3936,9 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative)
return QString();
QString fn = fileName(node);
- if (node && relative && node->parent() != relative) {
- if (node->parent()->isQmlType() && relative->isQmlType()) {
- if (node->parent()->isAbstract()) {
- /*
- This is a bit of a hack. What we discover with
- the three 'if' statements immediately above,
- is that node's parent is marked \qmlabstract
- but the link appears in a qdoc comment for a
- subclass of the node's parent. This means the
- link should refer to the file for the relative
- node, not the file for node.
- */
- fn = fileName(relative);
- }
- }
+ if (node && node->parent() && node->parent()->isQmlType() && node->parent()->isAbstract()) {
+ if (Generator::qmlTypeContext())
+ fn = fileName(Generator::qmlTypeContext());
}
QString link = fn;