diff options
-rw-r--r-- | src/qdoc/cppcodeparser.cpp | 196 | ||||
-rw-r--r-- | src/qdoc/cppcodeparser.h | 7 | ||||
-rw-r--r-- | src/qdoc/doc.cpp | 11 | ||||
-rw-r--r-- | src/qdoc/generator.cpp | 18 | ||||
-rw-r--r-- | src/qdoc/helpprojectwriter.cpp | 18 | ||||
-rw-r--r-- | src/qdoc/htmlgenerator.cpp | 31 | ||||
-rw-r--r-- | src/qdoc/node.cpp | 155 | ||||
-rw-r--r-- | src/qdoc/node.h | 44 | ||||
-rw-r--r-- | src/qdoc/qdocindexfiles.cpp | 42 | ||||
-rw-r--r-- | src/qdoc/qmlcodeparser.cpp | 4 | ||||
-rw-r--r-- | src/qdoc/sections.cpp | 48 | ||||
-rw-r--r-- | src/qdoc/tree.cpp | 16 |
12 files changed, 141 insertions, 449 deletions
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index a4fb0fd93..cd0c9e952 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -76,7 +76,7 @@ CppCodeParser::CppCodeParser() << COMMAND_VARIABLE << COMMAND_QMLTYPE << COMMAND_QMLPROPERTY - << COMMAND_QMLPROPERTYGROUP + << COMMAND_QMLPROPERTYGROUP // mws 13/03/2019 << COMMAND_QMLATTACHEDPROPERTY << COMMAND_QMLSIGNAL << COMMAND_QMLATTACHEDSIGNAL @@ -86,7 +86,7 @@ CppCodeParser::CppCodeParser() << COMMAND_QMLMODULE << COMMAND_JSTYPE << COMMAND_JSPROPERTY - << COMMAND_JSPROPERTYGROUP + << COMMAND_JSPROPERTYGROUP // mws 13/03/2019 << COMMAND_JSATTACHEDPROPERTY << COMMAND_JSSIGNAL << COMMAND_JSATTACHEDSIGNAL @@ -366,36 +366,6 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc, } /*! - A QML property group argument has the form... - - <QML-module>::<QML-type>::<name> - - This function splits the argument into those parts. - A <QML-module> is the QML equivalent of a C++ namespace. - So this function splits \a arg on "::" and stores the - parts in \a module, \a qmlTypeName, and \a name, and returns - true. If any part is not found, a qdoc warning is emitted - and false is returned. - */ -bool CppCodeParser::splitQmlPropertyGroupArg(const QString& arg, - QString& module, - QString& qmlTypeName, - QString& name, - const Location& location) -{ - QStringList colonSplit = arg.split("::"); - if (colonSplit.size() == 3) { - module = colonSplit[0]; - qmlTypeName = colonSplit[1]; - name = colonSplit[2]; - return true; - } - QString msg = "Unrecognizable QML module/component qualifier for " + arg; - location.warning(tr(msg.toLatin1().data())); - return false; -} - -/*! A QML property argument has the form... <type> <QML-type>::<name> @@ -448,112 +418,82 @@ bool CppCodeParser::splitQmlPropertyArg(const QString& arg, } /*! - Process the topic \a command group found in the \a doc with arguments \a args. - - Currently, this function is called only for \e{qmlproperty} - and \e{qmlattachedproperty}. */ -void CppCodeParser::processQmlProperties(const Doc& doc, - NodeList& nodes, - DocList& docs, - bool jsProps) +void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocList &docs) { + const TopicList& topics = doc.topicsUsed(); + if (topics.isEmpty()) + return; + QString arg; QString type; - QString topic; + QString group; QString module; - QString qmlTypeName; QString property; - QmlPropertyNode* qpn = nullptr; - QmlTypeNode* qmlType = nullptr; - QmlPropertyGroupNode* qpgn = nullptr; + QString qmlTypeName; - Topic qmlPropertyGroupTopic; - const TopicList& topics = doc.topicsUsed(); - for (int i=0; i<topics.size(); ++i) { - if ((topics.at(i).topic == COMMAND_QMLPROPERTYGROUP) || - (topics.at(i).topic == COMMAND_JSPROPERTYGROUP)) { - qmlPropertyGroupTopic = topics.at(i); - break; - } + Topic topic = topics.at(0); + bool jsProps = isJSPropertyTopic(topic.topic); + arg = topic.args; + if (splitQmlPropertyArg(arg, type, module, qmlTypeName, property, doc.location())) { + int i = property.indexOf('.'); + if (i != -1) + group = property.left(i); } - if (qmlPropertyGroupTopic.isEmpty() && topics.size() > 1) { - qmlPropertyGroupTopic = topics.at(0); - if (jsProps) - qmlPropertyGroupTopic.topic = COMMAND_JSPROPERTYGROUP; + + QmlTypeNode* qmlType = qdb_->findQmlType(module, qmlTypeName); + if (qmlType == nullptr) { + QString msg; + if (topics.size() > 1 && !group.isEmpty()) + msg = tr("QML/JS type '%1' not found for property group '%2'").arg(qmlTypeName).arg(group); else - qmlPropertyGroupTopic.topic = COMMAND_QMLPROPERTYGROUP; - arg = qmlPropertyGroupTopic.args; - if (splitQmlPropertyArg(arg, type, module, qmlTypeName, property, doc.location())) { - int i = property.indexOf('.'); - if (i != -1) { - property = property.left(i); - qmlPropertyGroupTopic.args = module + "::" + qmlTypeName + "::" + property; - doc.location().warning(tr("No QML property group command found; using \\%1 %2") - .arg(COMMAND_QMLPROPERTYGROUP).arg(qmlPropertyGroupTopic.args)); - } - else { - /* - Assumption: No '.' in the property name - means there is no property group. - */ - qmlPropertyGroupTopic.clear(); - } - } + msg = tr("QML/JS type '%1' not found for property '%2'").arg(qmlTypeName).arg(property); + doc.startLocation().warning(msg); + return; } - if (!qmlPropertyGroupTopic.isEmpty()) { - arg = qmlPropertyGroupTopic.args; - if (splitQmlPropertyGroupArg(arg, module, qmlTypeName, property, doc.location())) { - qmlType = qdb_->findQmlType(module, qmlTypeName); - if (qmlType) { - qpgn = new QmlPropertyGroupNode(qmlType, property); - qpgn->setLocation(doc.startLocation()); - if (jsProps) - qpgn->setGenus(Node::JS); - nodes.append(qpgn); - docs.append(doc); - } - } + SharedCommentNode* scn = nullptr; + if (topics.size() > 1) { + scn = new SharedCommentNode(qmlType, topics.size(), group); + scn->setLocation(doc.startLocation()); + if (jsProps) + scn->setGenus(Node::JS); + else + scn->setGenus(Node::QML); + nodes.append(scn); + docs.append(doc); } + for (int i=0; i<topics.size(); ++i) { - if (topics.at(i).topic == COMMAND_QMLPROPERTYGROUP) { - continue; - } - topic = topics.at(i).topic; + QString cmd = topics.at(i).topic; arg = topics.at(i).args; - if ((topic == COMMAND_QMLPROPERTY) || (topic == COMMAND_QMLATTACHEDPROPERTY) || - (topic == COMMAND_JSPROPERTY) || (topic == COMMAND_JSATTACHEDPROPERTY)) { - bool attached = topic.contains(QLatin1String("attached")); + if ((cmd == COMMAND_QMLPROPERTY) || (cmd == COMMAND_QMLATTACHEDPROPERTY) || + (cmd == COMMAND_JSPROPERTY) || (cmd == COMMAND_JSATTACHEDPROPERTY)) { + bool attached = topics.at(i).topic.contains(QLatin1String("attached")); if (splitQmlPropertyArg(arg, type, module, qmlTypeName, property, doc.location())) { - Aggregate* aggregate = qdb_->findQmlType(module, qmlTypeName); - if (!aggregate) - aggregate = qdb_->findQmlBasicType(module, qmlTypeName); - if (aggregate) { - if (aggregate->hasQmlProperty(property, attached) != nullptr) { - QString msg = tr("QML property documented multiple times: '%1'").arg(arg); - doc.startLocation().warning(msg); - } - else if (qpgn) { - qpn = new QmlPropertyNode(qpgn, property, type, attached); - qpn->setLocation(doc.startLocation()); - if (jsProps) - qpn->setGenus(Node::JS); - } - else { - qpn = new QmlPropertyNode(aggregate, property, type, attached); - qpn->setLocation(doc.startLocation()); - if (jsProps) - qpn->setGenus(Node::JS); - nodes.append(qpn); - docs.append(doc); - } + if (qmlType != qdb_->findQmlType(module, qmlTypeName)) { + QString msg = tr("All properties in a group must belong to the same type: '%1'").arg(arg); + doc.startLocation().warning(msg); + continue; + } + if (qmlType->hasQmlProperty(property, attached) != nullptr) { + QString msg = tr("QML property documented multiple times: '%1'").arg(arg); + doc.startLocation().warning(msg); + continue; } + QmlPropertyNode* qpn = new QmlPropertyNode(qmlType, property, type, attached); + if (scn != nullptr) + qpn->setSharedCommentNode(scn); + qpn->setLocation(doc.startLocation()); + if (jsProps) + qpn->setGenus(Node::JS); + else + qpn->setGenus(Node::QML); + nodes.append(qpn); + docs.append(doc); } - } else if (qpgn) { - doc.startLocation().warning( - tr("Invalid use of '\\%1'; not allowed in a '\\%2'").arg( - topic, qmlPropertyGroupTopic.topic)); + } else { + doc.startLocation().warning(tr("Command '\\%1'; not allowed with QML/JS property commands").arg(cmd)); } } } @@ -999,9 +939,7 @@ bool CppCodeParser::isQMLMethodTopic(const QString &t) */ bool CppCodeParser::isJSPropertyTopic(const QString &t) { - return (t == COMMAND_JSPROPERTY || - t == COMMAND_JSPROPERTYGROUP || - t == COMMAND_JSATTACHEDPROPERTY); + return (t == COMMAND_JSPROPERTY || t == COMMAND_JSATTACHEDPROPERTY); } /*! @@ -1010,17 +948,13 @@ bool CppCodeParser::isJSPropertyTopic(const QString &t) */ bool CppCodeParser::isQMLPropertyTopic(const QString &t) { - return (t == COMMAND_QMLPROPERTY || - t == COMMAND_QMLPROPERTYGROUP || - t == COMMAND_QMLATTACHEDPROPERTY); + return (t == COMMAND_QMLPROPERTY || t == COMMAND_QMLATTACHEDPROPERTY); } void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeList &nodes, DocList &docs) { - if (isQMLPropertyTopic(topic)) { - processQmlProperties(doc, nodes, docs, false); - } else if (isJSPropertyTopic(topic)) { - processQmlProperties(doc, nodes, docs, true); + if (isQMLPropertyTopic(topic) || isJSPropertyTopic(topic)) { + processQmlProperties(doc, nodes, docs); } else { ArgList args = doc.metaCommandArgs(topic); Node *node = nullptr; diff --git a/src/qdoc/cppcodeparser.h b/src/qdoc/cppcodeparser.h index 491ffb4cd..3d3f6a52c 100644 --- a/src/qdoc/cppcodeparser.h +++ b/src/qdoc/cppcodeparser.h @@ -73,12 +73,7 @@ protected: virtual Node* processTopicCommand(const Doc& doc, const QString& command, const ArgLocPair& arg); - void processQmlProperties(const Doc& doc, NodeList& nodes, DocList& docs, bool jsProps); - bool splitQmlPropertyGroupArg(const QString& arg, - QString& module, - QString& element, - QString& name, - const Location& location); + void processQmlProperties(const Doc &doc, NodeList &nodes, DocList &docs); bool splitQmlPropertyArg(const QString& arg, QString& type, QString& module, diff --git a/src/qdoc/doc.cpp b/src/qdoc/doc.cpp index a0d724695..979bf9f2a 100644 --- a/src/qdoc/doc.cpp +++ b/src/qdoc/doc.cpp @@ -1343,7 +1343,8 @@ void DocParser::parse(const QString& source, QString arg = getMetaCommandArgument(cmdStr); priv->metaCommandMap[cmdStr].append(ArgLocPair(arg,location())); if (possibleTopics.contains(cmdStr)) { - priv->topics_.append(Topic(cmdStr,arg)); + if (!cmdStr.endsWith(QLatin1String("propertygroup"))) + priv->topics_.append(Topic(cmdStr,arg)); } } else if (macroHash()->contains(cmdStr)) { const Macro ¯o = macroHash()->value(cmdStr); @@ -1437,8 +1438,12 @@ void DocParser::parse(const QString& source, if ((numUppercase >= 1 && numLowercase >= 2) || numStrangeSymbols > 0) { appendWord(cmdStr); } else { - location().warning(tr("Unknown command '\\%1'").arg(cmdStr), - detailsUnknownCommand(metaCommandSet,cmdStr)); + if (!cmdStr.endsWith("propertygroup")) { + // The QML and JS property group commands are no longer required + // for grouping QML and JS properties. They are allowed but ignored. + location().warning(tr("Unknown command '\\%1'").arg(cmdStr), + detailsUnknownCommand(metaCommandSet,cmdStr)); + } enterPara(); append(Atom::UnknownCommand, cmdStr); } diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp index 3836508f7..144f20704 100644 --- a/src/qdoc/generator.cpp +++ b/src/qdoc/generator.cpp @@ -368,8 +368,6 @@ QString Generator::fileBase(const Node *node) const { if (!node->isPageNode() && !node->isCollectionNode()) node = node->parent(); - if (node->isQmlPropertyGroup() || node->isJsPropertyGroup()) - node = node->parent(); if (node->hasFileNameBase()) return node->fileNameBase(); @@ -600,15 +598,8 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir) Node *parentNode = nullptr; - if ((parentNode = node->parent())) { - if (parentNode->isQmlPropertyGroup() || parentNode->isJsPropertyGroup()) { - parentNode = parentNode->parent(); - parentName = fullDocumentLocation(parentNode); - } - else { - parentName = fullDocumentLocation(node->parent()); - } - } + if ((parentNode = node->parent())) + parentName = fullDocumentLocation(node->parent()); switch (node->nodeType()) { case Node::Class: @@ -1083,7 +1074,7 @@ void Generator::generateDocumentation(Node* node) return; if (node->isInternal() && !showInternal_) return; - if (node->isExternalPage() || node->isQmlPropertyGroup() || node->isJsPropertyGroup()) + if (node->isExternalPage()) return; /* @@ -2213,9 +2204,6 @@ QString Generator::typeString(const Node *node) case Node::Property: case Node::QmlProperty: return "property"; - case Node::JsPropertyGroup: - case Node::QmlPropertyGroup: - return "property group"; case Node::Module: case Node::JsModule: case Node::QmlModule: diff --git a/src/qdoc/helpprojectwriter.cpp b/src/qdoc/helpprojectwriter.cpp index 93ef8a692..06e19af7f 100644 --- a/src/qdoc/helpprojectwriter.cpp +++ b/src/qdoc/helpprojectwriter.cpp @@ -141,8 +141,6 @@ void HelpProjectWriter::readSelectors(SubProject &subproject, const QStringList typeHash["qmlmodule"] = Node::QmlModule; typeHash["qmlproperty"] = Node::JsProperty; typeHash["jsproperty"] = Node::QmlProperty; - typeHash["jspropertygroup"] = Node::JsPropertyGroup; - typeHash["qmlpropertygroup"] = Node::QmlPropertyGroup; typeHash["qmlclass"] = Node::QmlType; // Legacy alias for 'qmltype' typeHash["qmltype"] = Node::QmlType; typeHash["qmlbasictype"] = Node::QmlBasicType; @@ -497,22 +495,6 @@ void HelpProjectWriter::generateSections(HelpProject &project, QXmlStreamWriter continue; if (child->isTextPageNode()) { childSet << child; - } else if (child->isQmlPropertyGroup() || child->isJsPropertyGroup()) { - /* - Don't visit QML/JS property group nodes, - but visit their children, which are all - QML/JS property nodes. - - This is probably not correct anymore, - because The Qml/Js Property Group is - an actual documented thing. - */ - const Aggregate *aggregate = static_cast<const Aggregate *>(child); - const NodeList &nodes = aggregate->childNodes(); - foreach (const Node *n, nodes) { - if (!n->isPrivate()) - childSet << n; - } } else { // Store member status of children project.memberStatus[node].insert(child->status()); diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp index 69e1d9852..0b4c0758c 100644 --- a/src/qdoc/htmlgenerator.cpp +++ b/src/qdoc/htmlgenerator.cpp @@ -3872,14 +3872,16 @@ QString HtmlGenerator::refForNode(const Node *node) else ref = node->name() + "-prop"; break; - case Node::QmlPropertyGroup: - case Node::JsPropertyGroup: case Node::Property: ref = node->name() + "-prop"; break; case Node::Variable: ref = node->name() + "-var"; break; + case Node::SharedComment: + if (node->isPropertyGroup()) + ref = node->name() + "-prop"; + break; default: break; } @@ -3982,8 +3984,7 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative) } QString link = fn; - if ((!node->isAggregate() && !node->isCollectionNode()) - || node->isQmlPropertyGroup() || node->isJsPropertyGroup()) { + if ((!node->isAggregate() && !node->isCollectionNode()) || node->isPropertyGroup()) { QString ref = refForNode(node); if (relative && fn == fileName(relative) && ref == refForNode(relative)) return QString(); @@ -4250,13 +4251,13 @@ void HtmlGenerator::generateQmlSummary(const Section& section, NodeVector::const_iterator m = section.members().constBegin(); while (m != section.members().constEnd()) { out() << "<li class=\"fn\">"; - generateQmlItem(*m,relative,marker,true); - if ((*m)->isQmlPropertyGroup() || (*m)->isJsPropertyGroup()) { - const QmlPropertyGroupNode* qpgn = static_cast<const QmlPropertyGroupNode*>(*m); - if (qpgn->count() > 0) { - NodeList::ConstIterator p = qpgn->constBegin(); + generateQmlItem(*m, relative, marker, true); + if ((*m)->isPropertyGroup()) { + const SharedCommentNode* scn = static_cast<const SharedCommentNode*>(*m); + if (scn->count() > 0) { + QVector<Node*>::ConstIterator p = scn->collective().constBegin(); out() << "<ul>\n"; - while (p != qpgn->constEnd()) { + while (p != scn->collective().constEnd()) { if ((*p)->isQmlProperty() || (*p)->isJsProperty()) { out() << "<li class=\"fn\">"; generateQmlItem(*p, relative, marker, true); @@ -4300,19 +4301,19 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node, out() << "<div class=\"qmlitem\">"; QString nodeRef = refForNode(node); - if (node->isQmlPropertyGroup() || node->isJsPropertyGroup()) { - const QmlPropertyGroupNode* qpgn = static_cast<const QmlPropertyGroupNode*>(node); - NodeList::ConstIterator p = qpgn->constBegin(); + if (node->isPropertyGroup()) { + const SharedCommentNode* scn = static_cast<const SharedCommentNode*>(node); + QVector<Node*>::ConstIterator p = scn->collective().constBegin(); out() << "<div class=\"qmlproto\">"; out() << "<div class=\"table\"><table class=\"qmlname\">"; - QString heading = qpgn->name() + " group"; + QString heading = scn->name() + " group"; out() << "<tr valign=\"top\" class=\"even\" id=\"" << nodeRef << "\">"; out() << "<th class=\"centerAlign\"><p>"; out() << "<a name=\"" + nodeRef + "\"></a>"; out() << "<b>" << heading << "</b>"; out() << "</p></th></tr>"; - while (p != qpgn->constEnd()) { + while (p != scn->collective().constEnd()) { if ((*p)->isQmlProperty() || (*p)->isJsProperty()) { qpn = static_cast<QmlPropertyNode*>(*p); nodeRef = refForNode(qpn); diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp index d5b3c8ec6..5f6f6925a 100644 --- a/src/qdoc/node.cpp +++ b/src/qdoc/node.cpp @@ -74,7 +74,6 @@ void Node::initialize() goals_.insert("module", Node::Module); goals_.insert("qmltype", Node::QmlType); goals_.insert("qmlmodule", Node::QmlModule); - goals_.insert("qmppropertygroup", Node::QmlPropertyGroup); goals_.insert("qmlproperty", Node::QmlProperty); goals_.insert("qmlsignal", Node::Function); goals_.insert("qmlsignalhandler", Node::Function); @@ -106,14 +105,12 @@ bool Node::changeType(NodeType from, NodeType to) switch (to) { case QmlType: case QmlModule: - case QmlPropertyGroup: case QmlProperty: case QmlBasicType: setGenus(Node::QML); break; case JsType: case JsModule: - case JsPropertyGroup: case JsProperty: case JsBasicType: setGenus(Node::JS); @@ -182,18 +179,6 @@ bool Node::nodeNameLessThan(const Node *n1, const Node *n2) } /*! - Increment the number of property groups seen in the current - file, and return the new value. - */ -int Node::incPropertyGroupCount() { return ++propertyGroupCount_; } - -/*! - Reset the number of property groups seen in the current file - to 0, because we are starting a new file. - */ -void Node::clearPropertyGroupCount() { propertyGroupCount_ = 0; } - -/*! \class Node \brief The Node class is a node in the Tree. @@ -394,11 +379,9 @@ Node::PageType Node::getPageType(Node::NodeType t) case Node::Property: case Node::Variable: case Node::QmlType: - case Node::QmlPropertyGroup: case Node::QmlProperty: case Node::QmlBasicType: case Node::JsType: - case Node::JsPropertyGroup: case Node::JsProperty: case Node::JsBasicType: case Node::SharedComment: @@ -448,13 +431,11 @@ Node::Genus Node::getGenus(Node::NodeType t) case Node::QmlModule: case Node::QmlProperty: case Node::QmlBasicType: - case Node::QmlPropertyGroup: return Node::QML; case Node::JsType: case Node::JsModule: case Node::JsProperty: case Node::JsBasicType: - case Node::JsPropertyGroup: return Node::JS; case Node::Page: case Node::Group: @@ -575,8 +556,6 @@ QString Node::nodeTypeString(NodeType t) return QLatin1String("QML module"); case QmlProperty: return QLatin1String("QML property"); - case QmlPropertyGroup: - return QLatin1String("QML property group"); case JsType: return QLatin1String("JS type"); @@ -586,8 +565,6 @@ QString Node::nodeTypeString(NodeType t) return QLatin1String("JS module"); case JsProperty: return QLatin1String("JS property"); - case JsPropertyGroup: - return QLatin1String("JS property group"); case SharedComment: return QLatin1String("shared comment"); @@ -979,18 +956,8 @@ Node *Aggregate::findChildNode(const QString& name, Node::Genus genus, int findF { if (genus == Node::DontCare) { Node *node = nonfunctionMap_.value(name); - if (node && !node->isQmlPropertyGroup()) // mws asks: Why not property group? + if (node) return node; - if (isQmlType() || isJsType()) { - for (int i=0; i<children_.size(); ++i) { - Node* n = children_.at(i); - if (n->isQmlPropertyGroup() || isJsPropertyGroup()) { - node = static_cast<Aggregate*>(n)->findChildNode(name, genus); - if (node) - return node; - } - } - } } else { NodeList nodes = nonfunctionMap_.values(name); if (!nodes.isEmpty()) { @@ -1050,21 +1017,6 @@ void Aggregate::findChildren(const QString &name, NodeVector &nodes) const ++i; } } - if (nodes.isEmpty() && (isQmlNode() || isJsNode())) { - int idx = name.indexOf(QChar('.')); - if (idx < 0) - return; - QString qmlPropGroup = name.left(idx); - NodeMap::const_iterator i = nonfunctionMap_.find(qmlPropGroup); - while (i != nonfunctionMap_.end() && i.key() == qmlPropGroup) { - if (i.value()->isQmlPropertyGroup() || i.value()->isJsPropertyGroup()) { - static_cast<Aggregate*>(i.value())->findChildren(name, nodes); - if (!nodes.isEmpty()) - return; - } - ++i; - } - } } /*! @@ -1159,11 +1111,6 @@ QStringList Aggregate::primaryKeys() */ void Aggregate::markUndocumentedChildrenInternal() { - // Property group children have no doc of their own but follow the - // the access/status of their parent - if (this->isQmlPropertyGroup() || this->isJsPropertyGroup()) - return; - foreach (Node *child, children_) { if (!child->isSharingComment() && !child->hasDoc() && !child->docMustBeGenerated()) { if (child->isFunction()) { @@ -1546,20 +1493,13 @@ QString Node::physicalModuleName() const */ QmlPropertyNode* Aggregate::hasQmlProperty(const QString& n) const { - NodeType goal1 = Node::QmlProperty; - NodeType goal2 = Node::QmlPropertyGroup; - if (isJsNode()) { - goal1 = Node::JsProperty; - goal2 = Node::JsPropertyGroup; - } + NodeType goal = Node::QmlProperty; + if (isJsNode()) + goal = Node::JsProperty; foreach (Node *child, children_) { - if (child->nodeType() == goal1) { + if (child->nodeType() == goal) { if (child->name() == n) return static_cast<QmlPropertyNode*>(child); - } else if (child->nodeType() == goal2) { - QmlPropertyNode* t = static_cast<Aggregate*>(child)->hasQmlProperty(n); - if (t) - return t; } } return nullptr; @@ -1572,20 +1512,13 @@ QmlPropertyNode* Aggregate::hasQmlProperty(const QString& n) const */ QmlPropertyNode* Aggregate::hasQmlProperty(const QString& n, bool attached) const { - NodeType goal1 = Node::QmlProperty; - NodeType goal2 = Node::QmlPropertyGroup; - if (isJsNode()) { - goal1 = Node::JsProperty; - goal2 = Node::JsPropertyGroup; - } + NodeType goal = Node::QmlProperty; + if (isJsNode()) + goal = Node::JsProperty; foreach (Node *child, children_) { - if (child->nodeType() == goal1) { + if (child->nodeType() == goal) { if (child->name() == n && child->isAttached() == attached) return static_cast<QmlPropertyNode*>(child); - } else if (child->nodeType() == goal2) { - QmlPropertyNode* t = static_cast<Aggregate*>(child)->hasQmlProperty(n, attached); - if (t) - return t; } } return nullptr; @@ -2885,64 +2818,6 @@ QmlBasicTypeNode::QmlBasicTypeNode(Aggregate *parent, const QString& name, Node: } /*! - Constructor for both the Qml property group node and the - Javascript property group node. The determination is made - by testing whether the \a parent is a QML node or a JS node. - */ -QmlPropertyGroupNode::QmlPropertyGroupNode(QmlTypeNode* parent, const QString& name) - : Aggregate(parent->isJsType() ? JsPropertyGroup : QmlPropertyGroup, parent, name) -{ - idNumber_ = -1; -} - -/*! - Return the property group node's id number for use in - constructing an id attribute for the property group. - If the id number is currently -1, increment the global - property group count and set the id number to the new - value. - */ -QString QmlPropertyGroupNode::idNumber() -{ - if (idNumber_ == -1) - idNumber_ = incPropertyGroupCount(); - return QString().setNum(idNumber_); -} - -/*! - Marks each of the properties in the property group - Private and Internal. - */ -void QmlPropertyGroupNode::markInternal() -{ - Node::markInternal(); - foreach (Node *n, children_) - n->markInternal(); -} - -/*! - Marks each of the properties in the property group - as the default. Probably wrong. - */ -void QmlPropertyGroupNode::markDefault() -{ - Node::markDefault(); - foreach (Node *n, children_) - n->markDefault(); -} - -/*! - Marks each of the properties in the property group - with the read only \a flag. - */ -void QmlPropertyGroupNode::markReadOnly(bool flag) -{ - Node::markReadOnly(flag); - foreach (Node *n, children_) - n->markReadOnly(flag); -} - -/*! Constructor for the QML property node. */ QmlPropertyNode::QmlPropertyNode(Aggregate* parent, @@ -3056,16 +2931,6 @@ PropertyNode* QmlPropertyNode::findCorrespondingCppProperty() } /*! - This returns the name of the owning QML type. - */ -QString QmlPropertyNode::element() const -{ - if (parent()->isQmlPropertyGroup()) - return parent()->element(); - return parent()->name(); -} - -/*! Construct the full document name for this node and return it. */ QString Node::fullDocumentName() const @@ -3074,7 +2939,7 @@ QString Node::fullDocumentName() const const Node* n = this; do { - if (!n->name().isEmpty() && !n->isQmlPropertyGroup()) + if (!n->name().isEmpty()) pieces.insert(0, n->name()); if ((n->isQmlType() || n->isJsType()) && !n->logicalModuleName().isEmpty()) { diff --git a/src/qdoc/node.h b/src/qdoc/node.h index c94b4c93e..8c5789a9c 100644 --- a/src/qdoc/node.h +++ b/src/qdoc/node.h @@ -91,12 +91,10 @@ public: Module, QmlType, QmlModule, - QmlPropertyGroup, QmlProperty, QmlBasicType, JsType, JsModule, - JsPropertyGroup, JsProperty, JsBasicType, SharedComment, @@ -186,7 +184,6 @@ public: bool isJsModule() const { return nodeType_ == JsModule; } bool isJsNode() const { return genus() == JS; } bool isJsProperty() const { return nodeType_ == JsProperty; } - bool isJsPropertyGroup() const { return nodeType_ == JsPropertyGroup; } bool isJsType() const { return nodeType_ == JsType; } bool isModule() const { return nodeType_ == Module; } bool isNamespace() const { return nodeType_ == Namespace; } @@ -201,7 +198,6 @@ public: bool isQmlModule() const { return nodeType_ == QmlModule; } bool isQmlNode() const { return genus() == QML; } bool isQmlProperty() const { return nodeType_ == QmlProperty; } - bool isQmlPropertyGroup() const { return nodeType_ == QmlPropertyGroup; } bool isQmlType() const { return nodeType_ == QmlType; } bool isRelatedNonmember() const { return relatedNonmember_; } bool isStruct() const { return nodeType_ == Struct; } @@ -227,6 +223,7 @@ public: virtual bool isReadOnly() const { return false; } virtual bool isRelatableType() const { return false; } virtual bool isMarkedReimp() const { return false; } + virtual bool isPropertyGroup() const { return false; } virtual bool isStatic() const { return false; } virtual bool isTextPageNode() const { return false; } // means PageNode but not Aggregate virtual bool isWrapper() const; @@ -352,8 +349,6 @@ public: static QString pageTypeString(PageType t); static QString nodeTypeString(NodeType t); static QString nodeSubtypeString(unsigned char t); - static int incPropertyGroupCount(); - static void clearPropertyGroupCount(); static void initialize(); static NodeType goal(const QString& t) { return goals_.value(t); } static bool nodeNameLessThan(const Node *first, const Node *second); @@ -767,33 +762,6 @@ public: bool isFirstClassAggregate() const override { return true; } }; -class QmlPropertyGroupNode : public Aggregate -{ -public: - QmlPropertyGroupNode(QmlTypeNode* parent, const QString& name); - virtual ~QmlPropertyGroupNode() { } - bool isQtQuickNode() const override { return parent()->isQtQuickNode(); } - QString qmlTypeName() const override { return parent()->qmlTypeName(); } - QString logicalModuleName() const override { - return parent()->logicalModuleName(); - } - QString logicalModuleVersion() const override { - return parent()->logicalModuleVersion(); - } - QString logicalModuleIdentifier() const override { - return parent()->logicalModuleIdentifier(); - } - QString idNumber() override; - QString element() const override { return parent()->name(); } - - void markInternal() override; - void markDefault() override; - void markReadOnly(bool flag) override; - -private: - int idNumber_; -}; - class QmlPropertyNode : public Node { Q_DECLARE_TR_FUNCTIONS(QDoc::QmlPropertyNode) @@ -830,7 +798,7 @@ public: QString logicalModuleIdentifier() const override { return parent()->logicalModuleIdentifier(); } - QString element() const override; + QString element() const override { return parent()->name(); } void markDefault() override { isdefault_ = true; } void markReadOnly(bool flag) override { readOnly_ = toFlagValue(flag); } @@ -931,8 +899,16 @@ public: : Node(Node::SharedComment, n->parent(), QString()) { collective_.reserve(1); n->setSharedCommentNode(this); } + SharedCommentNode(QmlTypeNode *parent, int count, QString &group) + : Node(Node::SharedComment, parent, group) { + collective_.reserve(count); + } virtual ~SharedCommentNode() { collective_.clear(); } + bool isPropertyGroup() const override { return !collective_.isEmpty() && + (collective_.at(0)->isQmlProperty() || collective_.at(0)->isJsProperty()); + } + int count() const { return collective_.size(); } void append(Node* n) { collective_.append(n); } const QVector<Node*>& collective() const { return collective_; } void setOverloadFlags(); diff --git a/src/qdoc/qdocindexfiles.cpp b/src/qdoc/qdocindexfiles.cpp index 5efd9c175..7302149a3 100644 --- a/src/qdoc/qdocindexfiles.cpp +++ b/src/qdoc/qdocindexfiles.cpp @@ -306,27 +306,6 @@ void QDocIndexFiles::readIndexSection(QXmlStreamReader& reader, else if (!indexUrl.isNull()) location = Location(name); node = qbtn; - } else if (elementName == QLatin1String("qmlpropertygroup")) { - QmlTypeNode* qcn = static_cast<QmlTypeNode*>(parent); - QmlPropertyGroupNode* qpgn = new QmlPropertyGroupNode(qcn, name); - if (attributes.hasAttribute(QLatin1String("location"))) - name = attributes.value("location").toString(); - if (!indexUrl.isEmpty()) - location = Location(indexUrl + QLatin1Char('/') + name); - else if (!indexUrl.isNull()) - location = Location(name); - node = qpgn; - } else if (elementName == QLatin1String("jspropertygroup")) { - QmlTypeNode* qcn = static_cast<QmlTypeNode*>(parent); - QmlPropertyGroupNode* qpgn = new QmlPropertyGroupNode(qcn, name); - qpgn->setGenus(Node::JS); - if (attributes.hasAttribute(QLatin1String("location"))) - name = attributes.value("location").toString(); - if (!indexUrl.isEmpty()) - location = Location(indexUrl + QLatin1Char('/') + name); - else if (!indexUrl.isNull()) - location = Location(name); - node = qpgn; } else if (elementName == QLatin1String("qmlproperty")) { QString type = attributes.value(QLatin1String("type")).toString(); bool attached = false; @@ -886,12 +865,6 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node, case Node::JsProperty: nodeName = "jsProperty"; break; - case Node::QmlPropertyGroup: - nodeName = "qmlpropertygroup"; - break; - case Node::JsPropertyGroup: - nodeName = "jspropertygroup"; - break; case Node::Proxy: nodeName = "proxy"; break; @@ -937,12 +910,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node, href = node->name(); if (node->isQmlNode() || node->isJsNode()) { Aggregate* p = node->parent(); - if (p) { - if (p->isQmlPropertyGroup() || p->isJsPropertyGroup()) - p = p->parent(); - if (p && (p->isQmlType() || p->isJsType()) && p->isAbstract()) - href.clear(); - } + if (p && (p->isQmlType() || p->isJsType()) && p->isAbstract()) + href.clear(); } if (!href.isEmpty()) writer.writeAttribute("href", href); @@ -1164,13 +1133,6 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter &writer, Node *node, writer.writeAttribute("brief", brief); } break; - case Node::JsPropertyGroup: - case Node::QmlPropertyGroup: - { - if (!brief.isEmpty()) - writer.writeAttribute("brief", brief); - } - break; case Node::Property: { const PropertyNode* propertyNode = static_cast<const PropertyNode*>(node); diff --git a/src/qdoc/qmlcodeparser.cpp b/src/qdoc/qmlcodeparser.cpp index b19c43bcb..437bcfd21 100644 --- a/src/qdoc/qmlcodeparser.cpp +++ b/src/qdoc/qmlcodeparser.cpp @@ -169,7 +169,7 @@ const QSet<QString>& QmlCodeParser::topicCommands() << COMMAND_QMLCLASS << COMMAND_QMLTYPE << COMMAND_QMLPROPERTY - << COMMAND_QMLPROPERTYGROUP + << COMMAND_QMLPROPERTYGROUP // mws 13/03/2019 << COMMAND_QMLATTACHEDPROPERTY << COMMAND_QMLSIGNAL << COMMAND_QMLATTACHEDSIGNAL @@ -178,7 +178,7 @@ const QSet<QString>& QmlCodeParser::topicCommands() << COMMAND_QMLBASICTYPE << COMMAND_JSTYPE << COMMAND_JSPROPERTY - << COMMAND_JSPROPERTYGROUP + << COMMAND_JSPROPERTYGROUP // mws 13/03/2019 << COMMAND_JSATTACHEDPROPERTY << COMMAND_JSSIGNAL << COMMAND_JSATTACHEDSIGNAL diff --git a/src/qdoc/sections.cpp b/src/qdoc/sections.cpp index 42cc8e8d9..5ba7ea09f 100644 --- a/src/qdoc/sections.cpp +++ b/src/qdoc/sections.cpp @@ -174,8 +174,6 @@ void Section::insert(Node *node) bool inherited = false; if (!node->isRelatedNonmember()) { Aggregate* p = node->parent(); - if (p->isQmlPropertyGroup()) - p = p->parent(); if (!p->isNamespace() && p != aggregate_) { if ((!p->isQmlType() && !p->isJsType()) || !p->isAbstract()) inherited = true; @@ -264,22 +262,10 @@ ClassMap *Section::newClassMap(const Aggregate* aggregate) */ void Section::add(ClassMap *classMap, Node *n) { - if (n->isQmlPropertyGroup() || n->isJsPropertyGroup()) { - Aggregate *aggregate = static_cast<Aggregate*>(n); - const NodeList &properties = aggregate->nonfunctionList(); - foreach (Node *p, properties) { - QString key = p->name(); - key = sortName(p, &key); - memberMap_.insert(key, p); - classMap->second.insert(key, p); - } - } - else { - QString key = n->name(); - key = sortName(n, &key); - memberMap_.insert(key, n); - classMap->second.insert(key, n); - } + QString key = n->name(); + key = sortName(n, &key); + memberMap_.insert(key, n); + classMap->second.insert(key, n); } /*! @@ -860,9 +846,7 @@ void Sections::distributeQmlNodeInDetailsVector(SectionVector &dv, Node *n) { if (n->isSharingComment()) return; - if (n->isQmlPropertyGroup() || n->isJsPropertyGroup()) - dv[QmlProperties].insert(n); - else if (n->isQmlProperty() || n->isJsProperty()) { + if (n->isQmlProperty() || n->isJsProperty()) { QmlPropertyNode* pn = static_cast<QmlPropertyNode*>(n); if (pn->isAttached()) dv[QmlAttachedProperties].insert(pn); @@ -883,15 +867,16 @@ void Sections::distributeQmlNodeInDetailsVector(SectionVector &dv, Node *n) else dv[QmlMethods].insert(fn); } - } else if (n->isSharedCommentNode() && n->hasDoc()) - dv[QmlMethods].insert(n); + } else if (n->isSharedCommentNode() && n->hasDoc()) { + dv[QmlMethods].insert(n); // incorrect? + } } void Sections::distributeQmlNodeInSummaryVector(SectionVector &sv, Node *n) { - if (n->isQmlPropertyGroup() || n->isJsPropertyGroup()) - sv[QmlProperties].insert(n); - else if (n->isQmlProperty() || n->isJsProperty()) { + if (n->isSharingComment()) + return; + if (n->isQmlProperty() || n->isJsProperty()) { QmlPropertyNode* pn = static_cast<QmlPropertyNode*>(n); if (pn->isAttached()) sv[QmlAttachedProperties].insert(pn); @@ -912,6 +897,17 @@ void Sections::distributeQmlNodeInSummaryVector(SectionVector &sv, Node *n) else sv[QmlMethods].insert(fn); } + } else if (n->isSharedCommentNode()) { + SharedCommentNode *scn = static_cast<SharedCommentNode*>(n); + if (scn->isPropertyGroup()) { + if (scn->name().isEmpty()) { + foreach (Node *n, scn->collective()) { + sv[QmlProperties].insert(n); + } + } else { + sv[QmlProperties].insert(scn); + } + } } } diff --git a/src/qdoc/tree.cpp b/src/qdoc/tree.cpp index 916f48ace..b63bec4cf 100644 --- a/src/qdoc/tree.cpp +++ b/src/qdoc/tree.cpp @@ -485,12 +485,7 @@ Node* Tree::findNodeRecursive(const QStringList& path, foreach (Node *n, children) { if (!n) continue; - if (n->isQmlPropertyGroup()) { - n = findNodeRecursive(path, pathIndex, n, isMatch); - if (n) - return n; - } - else if (n->name() == name) { + if (n->name() == name) { if (pathIndex+1 >= path.size()) { if ((n->*(isMatch))()) return n; @@ -542,14 +537,7 @@ Node* Tree::findNodeRecursive(const QStringList& path, foreach (Node *n, children) { if (!n) continue; - if (n->isQmlPropertyGroup()) { - if (type == Node::QmlProperty) { - n = findNodeRecursive(path, pathIndex, n, type); - if (n) - return n; - } - } - else if (n->name() == name) { + if (n->name() == name) { if (pathIndex+1 >= path.size()) { if ((n->nodeType() == type) || (type == Node::NoType)) return n; |