diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-03-27 23:34:33 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-03-27 23:34:33 (GMT) |
commit | f5542efa32c0e28f28b361c554f9ae2c3f6fc546 (patch) | |
tree | 6c2a8b9a46fcda2c72b5318bca247c46fc0bf36a /tools/qdoc3/node.cpp | |
parent | cdbb761416996efef99e6eccc7f42730d64f35cb (diff) | |
parent | 8faad8f5e7ddf03b4bf19ef51ddd1ad3c3b5f968 (diff) | |
download | Qt-f5542efa32c0e28f28b361c554f9ae2c3f6fc546.zip Qt-f5542efa32c0e28f28b361c554f9ae2c3f6fc546.tar.gz Qt-f5542efa32c0e28f28b361c554f9ae2c3f6fc546.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-doc-staging into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-doc-staging: (185 commits)
qdoc: Avoid infinite loops in table of contents generation.
Removed the documentation from the install rule.
qdoc: Added the <othermeta> element.
qdoc: Completed changing <section> structure.
Doc: Fixed reference to absolete API in exceptionsafety.html
Doc: Removed links to obsolete API in QResource
Doc: Fixed broken links in QIcon::fromTheme()
Doc: Fixed doc bug in undo framework example
Doc: Fixed typo.
qdoc: Changed <section> structure.
Doc: Typo fixes
Doc: Fixed snippet documenting QMetaObject::classInfo
Doc: Cannot alter SelectionMode of a combobox's view
qdoc: Added <publisher> and <permissions> elements.
qdoc: Added <component> element to contain the module name.
qdoc: Added <prodinfo> element and its contents to the metadata.
Doc: Fixed a doc bug in the Rogue example
Doc: Small change to QByteArray::resize()
Doc: Small change to ListModel docs
Doc: QtDemo now gives error message when example doc cannot be loaded
...
Diffstat (limited to 'tools/qdoc3/node.cpp')
-rw-r--r-- | tools/qdoc3/node.cpp | 176 |
1 files changed, 98 insertions, 78 deletions
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 7195322..0f85d37 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -771,6 +771,30 @@ void InnerNode::removeChild(Node *child) } } +/*! \fn QString InnerNode::author() const + Returns the author. + */ + +/*! \fn void InnerNode::setAuthor(const QString& author) + Sets the \a author. + */ + +/*! \fn QString InnerNode::publisher() const + Returns the publisher. + */ + +/*! \fn void InnerNode::setPublisher(const QString& publisher) + Sets the \a publisher. + */ + +/*! \fn QString InnerNode::permissions() const + Returns the permissions. + */ + +/*! \fn void InnerNode::setPermissions(const QString& permissions) + Sets the \a permissions. + */ + /*! Find the module (QtCore, QtGui, etc.) to which the class belongs. We do this by obtaining the full path to the header file's location @@ -834,6 +858,21 @@ void InnerNode::removeRelated(Node *pseudoChild) related.removeAll(pseudoChild); } +/*! \fn bool InnerNode::hasOtherMetadata() const + Returns tru if the other metadata map is not empty. + */ + +/*! + Insert the pair \a name and \a content into the other metadata map. + */ +void insertOtherMetadata(const QString& name, const QString& content) +{ +} + +/*! \fn const QMap<QString, QString>& InnerNode::otherMetadata() cont + Returns the map containing pairs for output as \c {<othermetadata>}. + */ + /*! \class LeafNode */ @@ -947,10 +986,35 @@ void ClassNode::fixBaseClasses() Search the child list to find the property node with the specified \a name. */ -const PropertyNode* ClassNode::findPropertyNode(const QString& name) const +const PropertyNode *ClassNode::findPropertyNode(const QString &name) const { - const Node* n = findNode(name,Node::Property); - return (n ? static_cast<const PropertyNode*>(n) : 0); + const Node *n = findNode(name, Node::Property); + + if (n) + return static_cast<const PropertyNode*>(n); + + const PropertyNode *pn = 0; + + const QList<RelatedClass> &bases = baseClasses(); + if (!bases.isEmpty()) { + for (int i = 0; i < bases.size(); ++i) { + const ClassNode *cn = bases[i].node; + pn = cn->findPropertyNode(name); + if (pn) + break; + } + } + const QList<RelatedClass>& ignoredBases = ignoredBaseClasses(); + if (!ignoredBases.isEmpty()) { + for (int i = 0; i < ignoredBases.size(); ++i) { + const ClassNode *cn = ignoredBases[i].node; + pn = cn->findPropertyNode(name); + if (pn) + break; + } + } + + return pn; } /*! @@ -1406,6 +1470,7 @@ PropertyNode::PropertyNode(InnerNode *parent, const QString& name) usr(Trool_Default), cst(false), fnl(false), + rev(-1), overrides(0) { // nothing. @@ -1657,7 +1722,7 @@ bool QmlPropertyNode::fromTrool(Trool troolean, bool defaultValue) } } -static QString valueType(const QString& n) +static QString valueType(const QString &n) { if (n == "QPoint") return "QDeclarativePointValueType"; @@ -1700,6 +1765,19 @@ bool QmlPropertyNode::isWritable(const Tree* tree) const if (wri != Trool_Default) return fromTrool(wri, false); + const PropertyNode *pn = correspondingProperty(tree); + if (pn) + return pn->isWritable(); + else { + location().warning(tr("Can't determine read-only status of QML property %1; writable assumed.").arg(name())); + return true; + } +} + +const PropertyNode *QmlPropertyNode::correspondingProperty(const Tree *tree) const +{ + const PropertyNode *pn; + Node* n = parent(); while (n && n->subType() != Node::QmlClass) n = n->parent(); @@ -1708,93 +1786,35 @@ bool QmlPropertyNode::isWritable(const Tree* tree) const const ClassNode* cn = qcn->classNode(); if (cn) { QStringList dotSplit = name().split(QChar('.')); - const PropertyNode* pn = cn->findPropertyNode(dotSplit[0]); + pn = cn->findPropertyNode(dotSplit[0]); if (pn) { if (dotSplit.size() > 1) { + // Find the C++ property corresponding to the QML property in + // the property group, <group>.<property>. + QStringList path(extractClassName(pn->qualifiedDataType())); const Node* nn = tree->findNode(path,Class); if (nn) { const ClassNode* cn = static_cast<const ClassNode*>(nn); - pn = cn->findPropertyNode(dotSplit[1]); - if (pn) { - return pn->isWritable(); - } - else { - const QList<RelatedClass>& bases = cn->baseClasses(); - if (!bases.isEmpty()) { - for (int i=0; i<bases.size(); ++i) { - const ClassNode* cn = bases[i].node; - pn = cn->findPropertyNode(dotSplit[1]); - if (pn) { - return pn->isWritable(); - } - } - } - const QList<RelatedClass>& ignoredBases = cn->ignoredBaseClasses(); - if (!ignoredBases.isEmpty()) { - for (int i=0; i<ignoredBases.size(); ++i) { - const ClassNode* cn = ignoredBases[i].node; - pn = cn->findPropertyNode(dotSplit[1]); - if (pn) { - return pn->isWritable(); - } - } - } - QString vt = valueType(cn->name()); - if (!vt.isEmpty()) { - QStringList path(vt); - const Node* vtn = tree->findNode(path,Class); - if (vtn) { - const ClassNode* cn = static_cast<const ClassNode*>(vtn); - pn = cn->findPropertyNode(dotSplit[1]); - if (pn) { - return pn->isWritable(); - } - } - } - } + const PropertyNode *pn2 = cn->findPropertyNode(dotSplit[1]); + if (pn2) + return pn2; // Return the property for the QML property. + else + return pn; // Return the property for the QML group. } } - else { - return pn->isWritable(); - } + else + return pn; } else { - const QList<RelatedClass>& bases = cn->baseClasses(); - if (!bases.isEmpty()) { - for (int i=0; i<bases.size(); ++i) { - const ClassNode* cn = bases[i].node; - pn = cn->findPropertyNode(dotSplit[0]); - if (pn) { - return pn->isWritable(); - } - } - } - const QList<RelatedClass>& ignoredBases = cn->ignoredBaseClasses(); - if (!ignoredBases.isEmpty()) { - for (int i=0; i<ignoredBases.size(); ++i) { - const ClassNode* cn = ignoredBases[i].node; - pn = cn->findPropertyNode(dotSplit[0]); - if (pn) { - return pn->isWritable(); - } - } - } - if (isAttached()) { - QString classNameAttached = cn->name() + "Attached"; - QStringList path(classNameAttached); - const Node* nn = tree->findNode(path,Class); - const ClassNode* acn = static_cast<const ClassNode*>(nn); - pn = acn->findPropertyNode(dotSplit[0]); - if (pn) { - return pn->isWritable(); - } - } + pn = cn->findPropertyNode(dotSplit[0]); + if (pn) + return pn; } } } - location().warning(tr("Can't determine read-only status of QML property %1; writable assumed.").arg(name())); - return true; + + return 0; } #endif |