diff options
| author | Martin Smith <[email protected]> | 2013-07-10 13:47:47 +0200 |
|---|---|---|
| committer | The Qt Project <[email protected]> | 2013-07-11 13:36:37 +0200 |
| commit | 2eb28f51ce4150fa03b2ddde8c39b502ae57d18a (patch) | |
| tree | ed0d394872df0a14e9352b49f34552f317bdd647 /src/tools/qdoc/qdocindexfiles.cpp | |
| parent | b06304e164ba47351fa292662c1e6383c081b5ca (diff) | |
qdoc: Implement better handling of QML property groups
The \qmlpropertygroup command is added, and qdoc is taught to generate
better output for it. The format is, e.g.:
\qmlpropertygroup QtQuick2::Item::anchors
\qmlproperty AnchorLine QtQuick2::Item::anchors.top
\qmlproperty AnchorLine QtQuick2::Item::anchors.bottom
\qmlproperty AnchorLine QtQuick2::Item::anchors.left
\qmlproperty AnchorLine QtQuick2::Item::anchors.right
\qmlproperty AnchorLine QtQuick2::Item::anchors.horizontalCenter
\qmlproperty AnchorLine QtQuick2::Item::anchors.verticalCenter
\qmlproperty AnchorLine QtQuick2::Item::anchors.baseline
\qmlproperty Item QtQuick2::Item::anchors.fill
\qmlproperty Item QtQuick2::Item::anchors.centerIn
\qmlproperty real QtQuick2::Item::anchors.margins
\qmlproperty real QtQuick2::Item::anchors.topMargin
\qmlproperty real QtQuick2::Item::anchors.bottomMargin
\qmlproperty real QtQuick2::Item::anchors.leftMargin
\qmlproperty real QtQuick2::Item::anchors.rightMargin
\qmlproperty real QtQuick2::Item::anchors.horizontalCenterOffset
\qmlproperty real QtQuick2::Item::anchors.verticalCenterOffset
\qmlproperty real QtQuick2::Item::anchors.baselineOffset
\qmlproperty bool QtQuick2::Item::anchors.alignWhenCentered
Task-number: QTBUG-32341
Change-Id: I4b06a3a061b23680e663e8d4e82ac9863ffd4ecb
Reviewed-by: Jerome Pasion <[email protected]>
Diffstat (limited to 'src/tools/qdoc/qdocindexfiles.cpp')
| -rw-r--r-- | src/tools/qdoc/qdocindexfiles.cpp | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index 5f2ebdfd077..4faa8ec8fce 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -217,8 +217,18 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, location = Location(name); node = qbtn; } - else if (element.nodeName() == "qmlproperty") { + else if (element.nodeName() == "qmlpropertygroup") { QmlClassNode* qcn = static_cast<QmlClassNode*>(parent); + QmlPropertyGroupNode* qpgn = new QmlPropertyGroupNode(qcn, name); + if (element.hasAttribute("location")) + name = element.attribute("location", QString()); + if (!indexUrl.isEmpty()) + location = Location(indexUrl + QLatin1Char('/') + name); + else if (!indexUrl.isNull()) + location = Location(name); + node = qpgn; + } + else if (element.nodeName() == "qmlproperty") { QString type = element.attribute("type"); bool attached = false; if (element.attribute("attached") == "true") @@ -226,7 +236,15 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, bool readonly = false; if (element.attribute("writable") == "false") readonly = true; - QmlPropertyNode* qpn = new QmlPropertyNode(qcn, name, type, attached); + QmlPropertyNode* qpn = 0; + if (parent->type() == Node::Document) { + QmlClassNode* qcn = static_cast<QmlClassNode*>(parent); + qpn = new QmlPropertyNode(qcn, name, type, attached); + } + else if (parent->type() == Node::QmlPropertyGroup) { + QmlPropertyGroupNode* qpgn = static_cast<QmlPropertyGroupNode*>(parent); + qpn = new QmlPropertyNode(qpgn, name, type, attached); + } qpn->setReadOnly(readonly); node = qpn; } @@ -281,10 +299,6 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, subtype = Node::QmlClass; ptype = Node::ApiPage; } - else if (element.attribute("subtype") == "qmlpropertygroup") { - subtype = Node::QmlPropertyGroup; - ptype = Node::ApiPage; - } else if (element.attribute("subtype") == "qmlbasictype") { subtype = Node::QmlBasicType; ptype = Node::ApiPage; @@ -501,7 +515,7 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, // Create some content for the node. QSet<QString> emptySet; - Doc doc(location, location, " ", emptySet); // placeholder + Doc doc(location, location, " ", emptySet, emptySet); // placeholder node->setDoc(doc); node->setIndexNodeFlag(); node->setOutputSubdirectory(project_.toLower()); @@ -644,6 +658,9 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, case Node::QmlProperty: nodeName = "qmlproperty"; break; + case Node::QmlPropertyGroup: + nodeName = "qmlpropertygroup"; + break; case Node::QmlSignal: nodeName = "qmlsignal"; break; @@ -927,6 +944,12 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, writer.writeAttribute("brief", brief); } break; + case Node::QmlPropertyGroup: + { + if (!brief.isEmpty()) + writer.writeAttribute("brief", brief); + } + break; case Node::Property: { const PropertyNode* propertyNode = static_cast<const PropertyNode*>(node); @@ -1179,17 +1202,12 @@ void QDocIndexFiles::generateIndexSections(QXmlStreamWriter& writer, foreach (Node* child, cnodes) { /* - 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. - - Do the same thing for collision nodes - we want children - of collision nodes in the index, but leaving out the - parent collision page will make searching for nodes easier. + Don't generate anything for a collision node. We want + children of collision nodes in the index, but leaving + out the parent collision page will make searching for + nodes easier. */ - if (child->subType() == Node::QmlPropertyGroup || - child->subType() == Node::Collision) { + if (child->subType() == Node::Collision) { const InnerNode* pgn = static_cast<const InnerNode*>(child); foreach (Node* c, pgn->childNodes()) { generateIndexSections(writer, c, generateInternalNodes); |
