diff options
author | Martin Smith <martin.smith@nokia.com> | 2011-08-11 09:42:27 (GMT) |
---|---|---|
committer | Martin Smith <martin.smith@nokia.com> | 2011-08-11 09:42:27 (GMT) |
commit | a9b6b923ab870ece76891c5330fdba26ce1bf613 (patch) | |
tree | 570a53f4322015ba8805bde49fca9bb8c4578949 /tools | |
parent | cc997e664ab6cd9e6551ec8228d1585d2a46a3d2 (diff) | |
download | Qt-a9b6b923ab870ece76891c5330fdba26ce1bf613.zip Qt-a9b6b923ab870ece76891c5330fdba26ce1bf613.tar.gz Qt-a9b6b923ab870ece76891c5330fdba26ce1bf613.tar.bz2 |
qdoc3: Updates for QTBUG-20739 (no read-only for QML components)
Task-number: QTBUG-20739
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.cpp | 3 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 3 | ||||
-rw-r--r-- | tools/qdoc3/node.cpp | 32 | ||||
-rw-r--r-- | tools/qdoc3/node.h | 4 |
4 files changed, 40 insertions, 2 deletions
diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 43d92df..4393e8d 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -4398,7 +4398,8 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node* node, writeStartTag(DT_li); writeGuidAttribute((Node*)qpn); QString attr; - if (!qpn->isWritable(myTree)) + const ClassNode* cn = qpn->declarativeCppNode(); + if (cn && !qpn->isWritable(myTree)) attr = "read-only"; if (qpgn->isDefault()) { if (!attr.isEmpty()) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index c7b6490..c0a32d8 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -3851,7 +3851,8 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, out() << "<a name=\"" + refForNode(qpn) + "\"></a>"; - if (!qpn->isWritable(myTree)) { + const ClassNode* cn = qpn->declarativeCppNode(); + if (cn && !qpn->isWritable(myTree)) { out() << "<span class=\"qmlreadonly\">read-only</span>"; } if (qpgn->isDefault()) diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index e14b08d..f6893fb 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -305,6 +305,38 @@ QString Node::ditaXmlHref() } /*! + If this node is a QML class node, return a pointer to it. + If it is a child of a QML class node, return a pointer to + the QML class node. Otherwise, return 0; + */ +const QmlClassNode* Node::qmlClassNode() const +{ + if (isQmlNode()) { + const Node* n = this; + while (n && n->subType() != Node::QmlClass) + n = n->parent(); + if (n && n->subType() == Node::QmlClass) + return static_cast<const QmlClassNode*>(n); + } + return 0; +} + +/*! + If this node is a QML node, find its QML class node, + and return a pointer to the C++ class node from the + QML class node. That pointer will be null if the QML + class node is a component. It will be non-null if + the QML class node is a QML element. + */ +const ClassNode* Node::declarativeCppNode() const +{ + const QmlClassNode* qcn = qmlClassNode(); + if (qcn) + return qcn->classNode(); + return 0; +} + +/*! \class InnerNode */ diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 2887923..3b031b6 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -59,8 +59,10 @@ QT_BEGIN_NAMESPACE class Node; +class ClassNode; class InnerNode; class ExampleNode; +class QmlClassNode; typedef QMap<QString, const Node*> NodeMap; typedef QMultiMap<QString, Node*> NodeMultiMap; @@ -200,6 +202,8 @@ class Node QString guid() const; QString ditaXmlHref(); QString extractClassName(const QString &string) const; + const QmlClassNode* qmlClassNode() const; + const ClassNode* declarativeCppNode() const; protected: Node(Type type, InnerNode* parent, const QString& name); |