summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2009-10-19 11:50:24 (GMT)
committerMartin Smith <msmith@trolltech.com>2009-10-19 11:51:53 (GMT)
commitf16fc0150fce1d78cc71c27c163baf45e8953aca (patch)
tree4ee6be62ef2c24cda3387ecb6815fb374b0b49a3 /tools/qdoc3
parent7a647e8c9efbbd46184bc4714159c82ae26be958 (diff)
downloadQt-f16fc0150fce1d78cc71c27c163baf45e8953aca.zip
Qt-f16fc0150fce1d78cc71c27c163baf45e8953aca.tar.gz
Qt-f16fc0150fce1d78cc71c27c163baf45e8953aca.tar.bz2
qdoc3: Added the \qmlattachedproperty command.
It works just like the \qmlproperty command, except that it puts the properties in a different section for attached properties.
Diffstat (limited to 'tools/qdoc3')
-rw-r--r--tools/qdoc3/cppcodemarker.cpp19
-rw-r--r--tools/qdoc3/cppcodeparser.cpp23
-rw-r--r--tools/qdoc3/htmlgenerator.cpp6
-rw-r--r--tools/qdoc3/node.cpp14
-rw-r--r--tools/qdoc3/node.h11
5 files changed, 56 insertions, 17 deletions
diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp
index ed3d150..36293f8 100644
--- a/tools/qdoc3/cppcodemarker.cpp
+++ b/tools/qdoc3/cppcodemarker.cpp
@@ -1112,6 +1112,10 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode,
"QML Properties",
"property",
"properties");
+ FastSection qmlattachedproperties(qmlClassNode,
+ "QML Attached Properties",
+ "property",
+ "properties");
FastSection qmlsignals(qmlClassNode,
"QML Signals",
"signal",
@@ -1128,7 +1132,11 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode,
NodeList::ConstIterator p = qpgn->childNodes().begin();
while (p != qpgn->childNodes().end()) {
if ((*p)->type() == Node::QmlProperty) {
- insert(qmlproperties,*p,style,Okay);
+ const QmlPropertyNode* pn = static_cast<const QmlPropertyNode*>(*p);
+ if (pn->isAttached())
+ insert(qmlattachedproperties,*p,style,Okay);
+ else
+ insert(qmlproperties,*p,style,Okay);
}
++p;
}
@@ -1142,17 +1150,23 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode,
++c;
}
append(sections,qmlproperties);
+ append(sections,qmlattachedproperties);
append(sections,qmlsignals);
append(sections,qmlmethods);
}
else if (style == Detailed) {
FastSection qmlproperties(qmlClassNode,"QML Property Documentation");
+ FastSection qmlattachedproperties(qmlClassNode,"QML Attached Property Documentation");
FastSection qmlsignals(qmlClassNode,"QML Signal Documentation");
FastSection qmlmethods(qmlClassNode,"QML Method Documentation");
NodeList::ConstIterator c = qmlClassNode->childNodes().begin();
while (c != qmlClassNode->childNodes().end()) {
if ((*c)->subType() == Node::QmlPropertyGroup) {
- insert(qmlproperties,*c,style,Okay);
+ const QmlPropGroupNode* pgn = static_cast<const QmlPropGroupNode*>(*c);
+ if (pgn->isAttached())
+ insert(qmlattachedproperties,*c,style,Okay);
+ else
+ insert(qmlproperties,*c,style,Okay);
}
else if ((*c)->type() == Node::QmlSignal) {
insert(qmlsignals,*c,style,Okay);
@@ -1163,6 +1177,7 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode,
++c;
}
append(sections,qmlproperties);
+ append(sections,qmlattachedproperties);
append(sections,qmlsignals);
append(sections,qmlmethods);
}
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index d93e24c..ad43b2b 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -88,6 +88,7 @@ QT_BEGIN_NAMESPACE
#ifdef QDOC_QML
#define COMMAND_QMLCLASS Doc::alias("qmlclass")
#define COMMAND_QMLPROPERTY Doc::alias("qmlproperty")
+#define COMMAND_QMLATTACHEDPROPERTY Doc::alias("qmlattachedproperty")
#define COMMAND_QMLINHERITS Doc::alias("inherits")
#define COMMAND_QMLSIGNAL Doc::alias("qmlsignal")
#define COMMAND_QMLMETHOD Doc::alias("qmlmethod")
@@ -482,6 +483,7 @@ QSet<QString> CppCodeParser::topicCommands()
<< COMMAND_VARIABLE
<< COMMAND_QMLCLASS
<< COMMAND_QMLPROPERTY
+ << COMMAND_QMLATTACHEDPROPERTY
<< COMMAND_QMLSIGNAL
<< COMMAND_QMLMETHOD;
#else
@@ -759,32 +761,40 @@ bool CppCodeParser::splitQmlArg(const Doc& doc,
/*!
Process the topic \a command group with arguments \a args.
- Currently, this function is called only for \e{qmlproperty}.
+ Currently, this function is called only for \e{qmlproperty}
+ and \e{qmlattachedproperty}.
*/
Node *CppCodeParser::processTopicCommandGroup(const Doc& doc,
const QString& command,
const QStringList& args)
{
QmlPropGroupNode* qmlPropGroup = 0;
- if (command == COMMAND_QMLPROPERTY) {
+ if ((command == COMMAND_QMLPROPERTY) ||
+ (command == COMMAND_QMLATTACHEDPROPERTY)) {
QString type;
QString element;
QString property;
+ bool attached = (command == COMMAND_QMLATTACHEDPROPERTY);
QStringList::ConstIterator arg = args.begin();
if (splitQmlPropertyArg(doc,(*arg),type,element,property)) {
Node* n = tre->findNode(QStringList(element),Node::Fake);
if (n && n->subType() == Node::QmlClass) {
QmlClassNode* qmlClass = static_cast<QmlClassNode*>(n);
if (qmlClass)
- qmlPropGroup = new QmlPropGroupNode(qmlClass,property);
+ qmlPropGroup = new QmlPropGroupNode(qmlClass,
+ property,
+ attached);
}
}
if (qmlPropGroup) {
- new QmlPropertyNode(qmlPropGroup,property,type);
+ new QmlPropertyNode(qmlPropGroup,property,type,attached);
++arg;
while (arg != args.end()) {
if (splitQmlPropertyArg(doc,(*arg),type,element,property)) {
- new QmlPropertyNode(qmlPropGroup,property,type);
+ new QmlPropertyNode(qmlPropGroup,
+ property,
+ type,
+ attached);
}
++arg;
}
@@ -1969,7 +1979,8 @@ bool CppCodeParser::matchDocsAndStuff()
There is a topic command. Process it.
*/
#ifdef QDOC_QML
- if (topic == COMMAND_QMLPROPERTY) {
+ if ((topic == COMMAND_QMLPROPERTY) ||
+ (topic == COMMAND_QMLATTACHEDPROPERTY)) {
Doc nodeDoc = doc;
Node *node = processTopicCommandGroup(nodeDoc,topic,args);
if (node != 0) {
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index c02dc2e..18c7916 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -1240,7 +1240,7 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner,
generateHeader(title, inner, marker, true);
generateTitle(title, subtitleText, SmallSubTitle, inner, marker);
-#ifdef QDOC_QML
+#ifdef QDOC_QML
if (classe && !classe->qmlElement().isEmpty()) {
generateInstantiatedBy(classe,marker);
}
@@ -3468,12 +3468,12 @@ QString HtmlGenerator::refForNode(const Node *node)
}
break;
case Node::Property:
-#ifdef QDOC_QML
+#ifdef QDOC_QML
case Node::QmlProperty:
#endif
ref = node->name() + "-prop";
break;
-#ifdef QDOC_QML
+#ifdef QDOC_QML
case Node::QmlSignal:
ref = node->name() + "-signal";
break;
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 558808f..49f2cc9 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -1158,8 +1158,12 @@ QString QmlClassNode::fileBase() const
Constructor for the Qml property group node. \a parent is
always a QmlClassNode.
*/
-QmlPropGroupNode::QmlPropGroupNode(QmlClassNode* parent, const QString& name)
- : FakeNode(parent, name, QmlPropertyGroup), isdefault(false)
+QmlPropGroupNode::QmlPropGroupNode(QmlClassNode* parent,
+ const QString& name,
+ bool attached)
+ : FakeNode(parent, name, QmlPropertyGroup),
+ isdefault(false),
+ att(attached)
{
// nothing.
}
@@ -1169,11 +1173,13 @@ QmlPropGroupNode::QmlPropGroupNode(QmlClassNode* parent, const QString& name)
*/
QmlPropertyNode::QmlPropertyNode(QmlPropGroupNode *parent,
const QString& name,
- const QString& type)
+ const QString& type,
+ bool attached)
: LeafNode(QmlProperty, parent, name),
dt(type),
sto(Trool_Default),
- des(Trool_Default)
+ des(Trool_Default),
+ att(attached)
{
// nothing.
}
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index f933270..fed4ea1 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -369,15 +369,19 @@ class QmlClassNode : public FakeNode
class QmlPropGroupNode : public FakeNode
{
public:
- QmlPropGroupNode(QmlClassNode* parent, const QString& name);
+ QmlPropGroupNode(QmlClassNode* parent,
+ const QString& name,
+ bool attached);
virtual ~QmlPropGroupNode() { }
const QString& element() const { return name(); }
void setDefault() { isdefault = true; }
bool isDefault() const { return isdefault; }
+ bool isAttached() const { return att; }
private:
bool isdefault;
+ bool att;
};
class QmlPropertyNode : public LeafNode
@@ -385,7 +389,8 @@ class QmlPropertyNode : public LeafNode
public:
QmlPropertyNode(QmlPropGroupNode* parent,
const QString& name,
- const QString& type);
+ const QString& type,
+ bool attached);
virtual ~QmlPropertyNode() { }
void setDataType(const QString& dataType) { dt = dataType; }
@@ -396,6 +401,7 @@ class QmlPropertyNode : public LeafNode
QString qualifiedDataType() const { return dt; }
bool isStored() const { return fromTrool(sto,true); }
bool isDesignable() const { return fromTrool(des,false); }
+ bool isAttached() const { return att; }
const QString& element() const { return parent()->name(); }
@@ -408,6 +414,7 @@ class QmlPropertyNode : public LeafNode
QString dt;
Trool sto;
Trool des;
+ bool att;
};
class QmlSignalNode : public LeafNode