diff options
author | Martin Smith <martin.smith@nokia.com> | 2012-06-11 11:29:31 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-12 04:29:31 +0200 |
commit | 14b07221664f95aea7603d6b7625c4467641b57c (patch) | |
tree | c77323108d2efc9e45f57e6a39a647248b54f906 /src/tools/qdoc/node.cpp | |
parent | 9e1a9878aaeac75f5c9e73a0d0e1a4e489e13cbc (diff) |
qdoc: Better error messages for QML command errors
Some error messages were not clear for these qdoc commands: \qmlclass,
\qmlmodule, \inqmlmodule, and \qmlproperty. They have been made clearer
now.
Also, qdoc now parses input files in the same order all the time now.
The order is alphabetic now. This might not be the optimal order.
Change-Id: Id53a5ec8105009c71f4bbd41973a54aed7821099
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
Diffstat (limited to 'src/tools/qdoc/node.cpp')
-rw-r--r-- | src/tools/qdoc/node.cpp | 66 |
1 files changed, 48 insertions, 18 deletions
diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp index 0e3286314b..4117c5090d 100644 --- a/src/tools/qdoc/node.cpp +++ b/src/tools/qdoc/node.cpp @@ -1331,7 +1331,7 @@ ClassNode::ClassNode(InnerNode *parent, const QString& name) : InnerNode(Class, parent, name) { hidden = false; - abstract = false; + abstract_ = false; qmlelement = 0; setPageType(ApiPage); } @@ -2043,7 +2043,8 @@ QmlClassNode::QmlClassNode(InnerNode *parent, const QString& name, ClassNode* cn) : FakeNode(parent, name, QmlClass, Node::ApiPage), - abstract(false), + abstract_(false), + cnodeRequired_(false), cnode_(cn), base_(0) { @@ -2160,10 +2161,10 @@ bool Node::setQmlModule(const ArgLocPair& arg) return true; } else - arg.second.warning(tr("Minor version number missing for '\\qmlmodule' or '\\inqmlmodule'; 0 assumed.")); + arg.second.warning(tr("Minor version number must be included in second arg of '\\qmlmodule' and '\\inqmlmodule'; '.0' assumed.")); } else - arg.second.warning(tr("Module version number missing for '\\qmlmodule' or '\\inqmlmodule'; 1.0 assumed.")); + arg.second.warning(tr("Module version number 'major.minor' must be second arg of '\\qmlmodule' and '\\inqmlmodule'; '1.0' assumed.")); return false; } @@ -2305,7 +2306,6 @@ QmlPropertyNode::QmlPropertyNode(QmlPropGroupNode *parent, designable_(FlagValueDefault), isdefault_(false), attached_(attached), - qproperty_(false), readOnly_(FlagValueDefault) { setPageType(ApiPage); @@ -2325,7 +2325,6 @@ QmlPropertyNode::QmlPropertyNode(QmlClassNode *parent, designable_(FlagValueDefault), isdefault_(false), attached_(attached), - qproperty_(false), readOnly_(FlagValueDefault) { setPageType(ApiPage); @@ -2352,32 +2351,63 @@ QmlPropertyNode::QmlPropertyNode(QmlPropertyNode* parent, designable_(FlagValueDefault), isdefault_(false), attached_(attached), - qproperty_(false), readOnly_(FlagValueDefault) { setPageType(ApiPage); } +#if 0 + const PropertyNode *correspondingProperty = 0; + ClassNode *correspondingClass = static_cast<QmlClassNode*>(qmlPropGroup->parent())->classNode(); + if (correspondingClass) { + correspondingProperty = qmlPropNode->correspondingProperty(tree_); + } + if (correspondingProperty) { + bool writableList = type.startsWith("list") && correspondingProperty->dataType().endsWith('*'); + qmlPropNode->setReadOnly(!(writableList || correspondingProperty->isWritable())); + } + + if (correspondingProperty) { + bool writableList = type.startsWith("list") && correspondingProperty->dataType().endsWith('*'); + qmlPropNode->setReadOnly(!(writableList || correspondingProperty->isWritable())); + } +#endif /*! Returns true if a QML property or attached property is - read-only. The algorithm for figuring this out is long + not read-only. The algorithm for figuring this out is long amd tedious and almost certainly will break. It currently - doesn't work for qmlproperty bool PropertyChanges::explicit, - because the tokenizer gets confused on "explicit". + doesn't work for the qmlproperty: + + \code + bool PropertyChanges::explicit, + \endcode + + ...because the tokenizer gets confused on \e{explicit}. */ bool QmlPropertyNode::isWritable(Tree* tree) { if (readOnly_ != FlagValueDefault) return !fromFlagValue(readOnly_, false); - if (qproperty_) { - PropertyNode* pn = correspondingProperty(tree); - if (pn) - return pn->isWritable(); - - location().warning(tr("Can't detect if QML property %1::%2::%3 is read-only; " - "writable assumed.") - .arg(qmlModuleIdentifier()).arg(qmlTypeName()).arg(name())); + QmlClassNode* qcn = qmlClassNode(); + if (qcn) { + if (qcn->cppClassRequired()) { + if (qcn->classNode()) { + PropertyNode* pn = correspondingProperty(tree); + if (pn) + return pn->isWritable(); + else + location().warning(tr("No Q_PROPERTY for QML property %1::%2::%3 " + "in C++ class documented as QML type: " + "(property not found in the C++ class or its base classes)") + .arg(qmlModuleIdentifier()).arg(qmlTypeName()).arg(name())); + } + else + location().warning(tr("No Q_PROPERTY for QML property %1::%2::%3 " + "in C++ class documented as QML type: " + "(C++ class not specified or not found).") + .arg(qmlModuleIdentifier()).arg(qmlTypeName()).arg(name())); + } } return true; } |