From a2c432e97818ec16ead9be0d0aee3e43cf10929e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 28 Jul 2014 14:21:37 +0200 Subject: qdoc: Allow choice of linking to QML or CPP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This update enables using QML or CPP as the parameter in square brackets for the \l command. You will use this when, for example, there exist both a C++ class named QWidget and a QML type named QWidget and your \l {QWidget} links to the wrong one. Suppose you write \l {QWidget} expecting it to link to the QML type named QWidget, but it links to the C++ class named QWidget. Then write this instead: \l [QML] {QWidget} Or if you wrote \l {QWidget} expecting it to link to the C++ class, but it links to the QML type, write this instead: \l [CPP] {QWidget} A qdoc warning is printed if qdoc can not recognize the parameter in square brackets. There will be a further update to complete this task for implementing the other type of parameter that can be in the square brackets. Task-number: QTBUG-39221 Change-Id: I5dd85478f968025ecbe337a8aabcc31d8b12a86d Reviewed-by: Topi Reiniƶ --- src/tools/qdoc/node.h | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'src/tools/qdoc/node.h') diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h index 37fbe482b0..67ad006e2c 100644 --- a/src/tools/qdoc/node.h +++ b/src/tools/qdoc/node.h @@ -117,6 +117,8 @@ public: LastSubtype }; + enum Genus { DontCare, CPP, QML }; + enum Access { Public, Protected, Private }; enum Status { @@ -217,6 +219,7 @@ public: virtual bool isNamespace() const { return false; } virtual bool isClass() const { return false; } virtual bool isQmlNode() const { return false; } + virtual bool isCppNode() const { return false; } virtual bool isQtQuickNode() const { return false; } virtual bool isAbstract() const { return false; } virtual bool isQmlPropertyGroup() const { return false; } @@ -233,6 +236,7 @@ public: virtual bool hasClasses() const { return false; } virtual void setAbstract(bool ) { } virtual void setWrapper() { } + virtual Node::Genus genus() const { return DontCare; } virtual QString title() const { return name(); } virtual QString fullTitle() const { return name(); } virtual QString subTitle() const { return QString(); } @@ -250,6 +254,7 @@ public: virtual void appendGroupName(const QString& ) { } virtual QString element() const { return QString(); } virtual Tree* tree() const; + virtual void findChildren(const QString& , NodeList& nodes) const { nodes.clear(); } bool isIndexNode() const { return indexNodeFlag_; } Type type() const { return nodeType_; } virtual SubType subType() const { return NoSubType; } @@ -271,6 +276,7 @@ public: void setLink(LinkType linkType, const QString &link, const QString &desc); Access access() const { return access_; } + bool isPrivate() const { return access_ == Private; } QString accessString() const; const Location& location() const { return loc_; } const Doc& doc() const { return doc_; } @@ -360,10 +366,11 @@ class InnerNode : public Node public: virtual ~InnerNode(); - Node* findChildNode(const QString& name) const; - Node* findChildNode(const QString& name, bool qml) const; + Node* findChildNode(const QString& name, Node::Genus genus) const; + //Node* findChildNode(const QString& name, bool qml) const; Node* findChildNode(const QString& name, Type type); - void findNodes(const QString& name, QList& n); + //void findNodes(const QString& name, NodeList& n); + virtual void findChildren(const QString& name, NodeList& nodes) const; FunctionNode* findFunctionNode(const QString& name) const; FunctionNode* findFunctionNode(const FunctionNode* clone); void addInclude(const QString &include); @@ -443,6 +450,8 @@ public: virtual ~NamespaceNode() { } virtual bool isNamespace() const { return true; } virtual Tree* tree() const { return (parent() ? parent()->tree() : tree_); } + virtual bool isCppNode() const { return true; } + virtual Node::Genus genus() const { return Node::CPP; } void setTree(Tree* t) { tree_ = t; } private: @@ -473,7 +482,9 @@ public: ClassNode(InnerNode* parent, const QString& name); virtual ~ClassNode() { } virtual bool isClass() const { return true; } + virtual bool isCppNode() const { return true; } virtual bool isWrapper() const { return wrapper_; } + virtual Node::Genus genus() const { return Node::CPP; } virtual QString obsoleteLink() const { return obsoleteLink_; } virtual void setObsoleteLink(const QString& t) { obsoleteLink_ = t; } virtual void setWrapper() { wrapper_ = true; } @@ -618,6 +629,7 @@ public: virtual QString qmlModuleIdentifier() const; virtual QmlModuleNode* qmlModule() const { return qmlModule_; } virtual void setQmlModule(QmlModuleNode* t) { qmlModule_ = t; } + virtual Node::Genus genus() const { return Node::QML; } const ImportList& importList() const { return importList_; } void setImportList(const ImportList& il) { importList_ = il; } const QString& qmlBaseName() const { return qmlBaseName_; } @@ -655,6 +667,7 @@ public: virtual ~QmlBasicTypeNode() { } virtual bool isQmlNode() const { return true; } virtual bool isQmlBasicType() const { return true; } + virtual Node::Genus genus() const { return Node::QML; } }; class QmlPropertyGroupNode : public InnerNode @@ -670,6 +683,7 @@ public: virtual QString qmlModuleIdentifier() const { return parent()->qmlModuleIdentifier(); } virtual QString idNumber(); virtual bool isQmlPropertyGroup() const { return true; } + virtual Node::Genus genus() const { return Node::QML; } virtual QString element() const { return parent()->name(); } @@ -688,6 +702,7 @@ public: bool attached); virtual ~QmlPropertyNode() { } + virtual Node::Genus genus() const { return Node::QML; } virtual void setDataType(const QString& dataType) { type_ = dataType; } void setStored(bool stored) { stored_ = toFlagValue(stored); } void setDesignable(bool designable) { designable_ = toFlagValue(designable); } @@ -746,6 +761,8 @@ public: EnumNode(InnerNode* parent, const QString& name); virtual ~EnumNode() { } + virtual Node::Genus genus() const { return Node::CPP; } + virtual bool isCppNode() const { return true; } void addItem(const EnumItem& item); void setFlagsType(TypedefNode* typedeff); bool hasItem(const QString &name) const { return names.contains(name); } @@ -767,6 +784,8 @@ public: TypedefNode(InnerNode* parent, const QString& name); virtual ~TypedefNode() { } + virtual Node::Genus genus() const { return Node::CPP; } + virtual bool isCppNode() const { return true; } const EnumNode* associatedEnum() const { return ae; } private: @@ -873,6 +892,8 @@ public: (type() == QmlMethod) || (type() == QmlSignalHandler)); } + virtual bool isCppNode() const { return !isQmlNode(); } + virtual Node::Genus genus() const { return (isQmlNode() ? Node::QML : Node::CPP); } virtual bool isQtQuickNode() const { return parent()->isQtQuickNode(); } virtual QString qmlTypeName() const { return parent()->qmlTypeName(); } virtual QString qmlModuleName() const { return parent()->qmlModuleName(); } @@ -911,6 +932,8 @@ public: PropertyNode(InnerNode* parent, const QString& name); virtual ~PropertyNode() { } + virtual Node::Genus genus() const { return Node::CPP; } + virtual bool isCppNode() const { return true; } virtual void setDataType(const QString& dataType) { type_ = dataType; } void addFunction(FunctionNode* function, FunctionRole role); void addSignal(FunctionNode* function, FunctionRole role); @@ -998,6 +1021,8 @@ public: VariableNode(InnerNode* parent, const QString &name); virtual ~VariableNode() { } + virtual Node::Genus genus() const { return Node::CPP; } + virtual bool isCppNode() const { return true; } void setLeftType(const QString &leftType) { lt = leftType; } void setRightType(const QString &rightType) { rt = rightType; } void setStatic(bool statique) { sta = statique; } @@ -1084,6 +1109,7 @@ class ModuleNode : public CollectionNode virtual ~ModuleNode() { } virtual bool isModule() const { return true; } + virtual bool isCppNode() const { return true; } virtual void setQtVariable(const QString& v) { qtVariable_ = v; } virtual QString qtVariable() const { return qtVariable_; } @@ -1098,6 +1124,7 @@ class QmlModuleNode : public CollectionNode : CollectionNode(Node::QmlModule, parent, name) { } virtual ~QmlModuleNode() { } + virtual bool isQmlNode() const { return true; } virtual bool isQmlModule() const { return true; } virtual QString qmlModuleName() const { return qmlModuleName_; } virtual QString qmlModuleVersion() const { -- cgit v1.2.3