summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-10-30 01:57:31 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-10-30 01:57:31 (GMT)
commit502f58df4643c6d9189db0297d3869bdb6a6ba4b (patch)
tree38e9c362efb67241e16ac6b122baebd736edcc03 /tools/qdoc3
parentd6b889fcd8f28e430d6082f0290b00030e30d3ca (diff)
downloadQt-502f58df4643c6d9189db0297d3869bdb6a6ba4b.zip
Qt-502f58df4643c6d9189db0297d3869bdb6a6ba4b.tar.gz
Qt-502f58df4643c6d9189db0297d3869bdb6a6ba4b.tar.bz2
qdoc3: display 'read-only' in QML docs for read only properties.
Diffstat (limited to 'tools/qdoc3')
-rw-r--r--tools/qdoc3/cppcodeparser.cpp21
-rw-r--r--tools/qdoc3/htmlgenerator.cpp4
-rw-r--r--tools/qdoc3/node.h7
-rw-r--r--tools/qdoc3/test/classic.css7
4 files changed, 33 insertions, 6 deletions
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index 84ec3f4..509613a 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -799,14 +799,26 @@ Node *CppCodeParser::processTopicCommandGroup(const Doc& doc,
}
}
if (qmlPropGroup) {
- new QmlPropertyNode(qmlPropGroup,property,type,attached);
+ const ClassNode *correspondingClass = static_cast<const QmlClassNode*>(qmlPropGroup->parent())->classNode();
+ PropertyNode *correspondingProperty = 0;
+ if (correspondingClass)
+ correspondingProperty = static_cast<PropertyNode*>((Node*)correspondingClass->findNode(property, Node::Property));
+ QmlPropertyNode *qmlPropNode = new QmlPropertyNode(qmlPropGroup,property,type,attached);
+ if (correspondingProperty) {
+ bool writableList = type.startsWith("list") && correspondingProperty->dataType().endsWith('*');
+ qmlPropNode->setWritable(writableList || correspondingProperty->isWritable());
+ }
++arg;
while (arg != args.end()) {
if (splitQmlPropertyArg(doc,(*arg),type,element,property)) {
- new QmlPropertyNode(qmlPropGroup,
+ QmlPropertyNode * qmlPropNode = new QmlPropertyNode(qmlPropGroup,
property,
type,
attached);
+ if (correspondingProperty) {
+ bool writableList = type.startsWith("list") && correspondingProperty->dataType().endsWith('*');
+ qmlPropNode->setWritable(writableList || correspondingProperty->isWritable());
+ }
}
++arg;
}
@@ -1751,9 +1763,10 @@ bool CppCodeParser::matchProperty(InnerNode *parent)
if (key == "READ")
tre->addPropertyFunction(property, value, PropertyNode::Getter);
- else if (key == "WRITE")
+ else if (key == "WRITE") {
tre->addPropertyFunction(property, value, PropertyNode::Setter);
- else if (key == "STORED")
+ property->setWritable(true);
+ } else if (key == "STORED")
property->setStored(value.toLower() == "true");
else if (key == "DESIGNABLE")
property->setDesignable(value.toLower() == "true");
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index eaf4b2e..35bb6c2 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -4192,13 +4192,15 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node,
const QmlPropGroupNode* qpgn = static_cast<const QmlPropGroupNode*>(node);
NodeList::ConstIterator p = qpgn->childNodes().begin();
out() << "<div class=\"qmlproto\">";
- out() << "<table class=\"qmlname\">";
+ out() << "<table width=\"100%\" class=\"qmlname\">";
while (p != qpgn->childNodes().end()) {
if ((*p)->type() == Node::QmlProperty) {
qpn = static_cast<const QmlPropertyNode*>(*p);
out() << "<tr><td>";
out() << "<a name=\"" + refForNode(qpn) + "\"></a>";
+ if (!qpn->isWritable())
+ out() << "<span class=\"qmlreadonly\">read-only</span>";
generateQmlItem(qpn, relative, marker, false);
out() << "</td></tr>";
if (qpgn->isDefault()) {
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index 3252964..5712879 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -398,11 +398,13 @@ class QmlPropertyNode : public LeafNode
void setDataType(const QString& dataType) { dt = dataType; }
void setStored(bool stored) { sto = toTrool(stored); }
void setDesignable(bool designable) { des = toTrool(designable); }
+ void setWritable(bool writable) { wri = toTrool(writable); }
const QString &dataType() const { return dt; }
QString qualifiedDataType() const { return dt; }
bool isStored() const { return fromTrool(sto,true); }
bool isDesignable() const { return fromTrool(des,false); }
+ bool isWritable() const { return fromTrool(wri,true); }
bool isAttached() const { return att; }
const QString& element() const { return static_cast<QmlPropGroupNode*>(parent())->element(); }
@@ -416,6 +418,7 @@ class QmlPropertyNode : public LeafNode
QString dt;
Trool sto;
Trool des;
+ Trool wri;
bool att;
};
@@ -637,6 +640,7 @@ class PropertyNode : public LeafNode
void addSignal(FunctionNode *function, FunctionRole role);
void setStored(bool stored) { sto = toTrool(stored); }
void setDesignable(bool designable) { des = toTrool(designable); }
+ void setWritable(bool writable) { wri = toTrool(writable); }
void setOverriddenFrom(const PropertyNode *baseProperty);
const QString &dataType() const { return dt; }
@@ -649,6 +653,7 @@ class PropertyNode : public LeafNode
NodeList notifiers() const { return functions(Notifier); }
bool isStored() const { return fromTrool(sto, storedDefault()); }
bool isDesignable() const { return fromTrool(des, designableDefault()); }
+ bool isWritable() const { return fromTrool(wri, writableDefault()); }
const PropertyNode *overriddenFrom() const { return overrides; }
private:
@@ -659,11 +664,13 @@ class PropertyNode : public LeafNode
bool storedDefault() const { return true; }
bool designableDefault() const { return !setters().isEmpty(); }
+ bool writableDefault() const { return !setters().isEmpty(); }
QString dt;
NodeList funcs[NumFunctionRoles];
Trool sto;
Trool des;
+ Trool wri;
const PropertyNode *overrides;
};
diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css
index 320da66..b8cae8e 100644
--- a/tools/qdoc3/test/classic.css
+++ b/tools/qdoc3/test/classic.css
@@ -268,10 +268,15 @@ span.string,span.char
border-style: solid;
border-color: #ddd;
font-weight: bold;
- padding: 6px 0px 6px 10px;
+ padding: 6px 10px 6px 10px;
margin: 42px 0px 0px 0px;
}
+.qmlreadonly {
+ float: right;
+ color: red
+}
+
.qmldoc {
}