summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/qdoc/.prev_CMakeLists.txt1
-rw-r--r--src/qdoc/CMakeLists.txt1
-rw-r--r--src/qdoc/cppcodemarker.cpp1
-rw-r--r--src/qdoc/cppcodeparser.cpp1
-rw-r--r--src/qdoc/docbookgenerator.cpp1
-rw-r--r--src/qdoc/htmlgenerator.cpp1
-rw-r--r--src/qdoc/node.cpp116
-rw-r--r--src/qdoc/node.h42
-rw-r--r--src/qdoc/qdoc.pro2
-rw-r--r--src/qdoc/qdocindexfiles.cpp1
-rw-r--r--src/qdoc/qmlpropertynode.cpp146
-rw-r--r--src/qdoc/qmlpropertynode.h83
-rw-r--r--src/qdoc/qmlvisitor.cpp1
-rw-r--r--src/qdoc/sections.cpp1
14 files changed, 241 insertions, 157 deletions
diff --git a/src/qdoc/.prev_CMakeLists.txt b/src/qdoc/.prev_CMakeLists.txt
index 82ec04d3b..2d98c5ec7 100644
--- a/src/qdoc/.prev_CMakeLists.txt
+++ b/src/qdoc/.prev_CMakeLists.txt
@@ -45,6 +45,7 @@ qt_add_tool(qdoc
qmlcodemarker.cpp qmlcodemarker.h
qmlcodeparser.cpp qmlcodeparser.h
qmlmarkupvisitor.cpp qmlmarkupvisitor.h
+ qmlpropertynode.cpp qmlpropertynode.h
qmlvisitor.cpp qmlvisitor.h
quoter.cpp quoter.h
sections.cpp sections.h
diff --git a/src/qdoc/CMakeLists.txt b/src/qdoc/CMakeLists.txt
index a96bf967e..07fac4108 100644
--- a/src/qdoc/CMakeLists.txt
+++ b/src/qdoc/CMakeLists.txt
@@ -46,6 +46,7 @@ qt_add_tool(qdoc
qmlcodemarker.cpp qmlcodemarker.h
qmlcodeparser.cpp qmlcodeparser.h
qmlmarkupvisitor.cpp qmlmarkupvisitor.h
+ qmlpropertynode.cpp qmlpropertynode.h
qmlvisitor.cpp qmlvisitor.h
quoter.cpp quoter.h
sections.cpp sections.h
diff --git a/src/qdoc/cppcodemarker.cpp b/src/qdoc/cppcodemarker.cpp
index 64b5450a1..b7ea746df 100644
--- a/src/qdoc/cppcodemarker.cpp
+++ b/src/qdoc/cppcodemarker.cpp
@@ -35,6 +35,7 @@
#include "enumnode.h"
#include "functionnode.h"
#include "propertynode.h"
+#include "qmlpropertynode.h"
#include "text.h"
#include "tree.h"
#include "typedefnode.h"
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp
index 68890f01f..8cbe85bdd 100644
--- a/src/qdoc/cppcodeparser.cpp
+++ b/src/qdoc/cppcodeparser.cpp
@@ -33,6 +33,7 @@
#include "generator.h"
#include "loggingcategory.h"
#include "qdocdatabase.h"
+#include "qmlpropertynode.h"
#include "sharedcommentnode.h"
#include <QtCore/qdebug.h>
diff --git a/src/qdoc/docbookgenerator.cpp b/src/qdoc/docbookgenerator.cpp
index 5547ca904..dc87da25c 100644
--- a/src/qdoc/docbookgenerator.cpp
+++ b/src/qdoc/docbookgenerator.cpp
@@ -37,6 +37,7 @@
#include "propertynode.h"
#include "quoter.h"
#include "qdocdatabase.h"
+#include "qmlpropertynode.h"
#include "separator.h"
#include "sharedcommentnode.h"
#include "typedefnode.h"
diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp
index 626498698..cb198f66c 100644
--- a/src/qdoc/htmlgenerator.cpp
+++ b/src/qdoc/htmlgenerator.cpp
@@ -37,6 +37,7 @@
#include "node.h"
#include "propertynode.h"
#include "qdocdatabase.h"
+#include "qmlpropertynode.h"
#include "separator.h"
#include "sharedcommentnode.h"
#include "tree.h"
diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp
index 205015f77..21a56fccf 100644
--- a/src/qdoc/node.cpp
+++ b/src/qdoc/node.cpp
@@ -36,6 +36,7 @@
#include "generator.h"
#include "propertynode.h"
#include "qdocdatabase.h"
+#include "qmlpropertynode.h"
#include "sharedcommentnode.h"
#include "tokenizer.h"
#include "tree.h"
@@ -3812,121 +3813,6 @@ QmlBasicTypeNode::QmlBasicTypeNode(Aggregate *parent, const QString &name, Node:
}
/*!
- Constructor for the QML property node.
- */
-QmlPropertyNode::QmlPropertyNode(Aggregate *parent, const QString &name, const QString &type,
- bool attached)
- : Node(parent->isJsType() ? JsProperty : QmlProperty, parent, name),
- type_(type),
- stored_(FlagValueDefault),
- designable_(FlagValueDefault),
- isAlias_(false),
- isdefault_(false),
- attached_(attached),
- readOnly_(FlagValueDefault)
-{
- if (type_ == QString("alias"))
- isAlias_ = true;
- if (name.startsWith("__"))
- setStatus(Internal);
-}
-
-/*!
- Returns \c true if a QML property or attached property is
- not read-only. The algorithm for figuring this out is long
- amd tedious and almost certainly will break. It currently
- doesn't work for the qmlproperty:
-
- \code
- bool PropertyChanges::explicit,
- \endcode
-
- ...because the tokenizer gets confused on \e{explicit}.
- */
-bool QmlPropertyNode::isWritable()
-{
- if (readOnly_ != FlagValueDefault)
- return !fromFlagValue(readOnly_, false);
-
- QmlTypeNode *qcn = qmlTypeNode();
- if (qcn) {
- if (qcn->cppClassRequired()) {
- if (qcn->classNode()) {
- PropertyNode *pn = findCorrespondingCppProperty();
- if (pn)
- return pn->isWritable();
- else
- defLocation().warning(
- QStringLiteral(
- "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(logicalModuleName())
- .arg(qmlTypeName())
- .arg(name()));
- } else
- defLocation().warning(QStringLiteral("No Q_PROPERTY for QML property %1::%2::%3 "
- "in C++ class documented as QML type: "
- "(C++ class not specified or not found).")
- .arg(logicalModuleName())
- .arg(qmlTypeName())
- .arg(name()));
- }
- }
- return true;
-}
-
-/*!
- Returns a pointer this QML property's corresponding C++
- property, if it has one.
- */
-PropertyNode *QmlPropertyNode::findCorrespondingCppProperty()
-{
- PropertyNode *pn;
- Node *n = parent();
- while (n && !(n->isQmlType() || n->isJsType()))
- n = n->parent();
- if (n) {
- QmlTypeNode *qcn = static_cast<QmlTypeNode *>(n);
- ClassNode *cn = qcn->classNode();
- if (cn) {
- /*
- If there is a dot in the property name, first
- find the C++ property corresponding to the QML
- property group.
- */
- QStringList dotSplit = name().split(QChar('.'));
- pn = cn->findPropertyNode(dotSplit[0]);
- if (pn) {
- /*
- Now find the C++ property corresponding to
- the QML property in the QML property group,
- <group>.<property>.
- */
- if (dotSplit.size() > 1) {
- QStringList path(extractClassName(pn->qualifiedDataType()));
- Node *nn = QDocDatabase::qdocDB()->findClassNode(path);
- if (nn) {
- ClassNode *cn = static_cast<ClassNode *>(nn);
- PropertyNode *pn2 = cn->findPropertyNode(dotSplit[1]);
- /*
- If found, return the C++ property
- corresponding to the QML property.
- Otherwise, return the C++ property
- corresponding to the QML property
- group.
- */
- return (pn2 ? pn2 : pn);
- }
- } else
- return pn;
- }
- }
- }
- return nullptr;
-}
-
-/*!
\class ProxyNode
\brief A class for representing an Aggregate that is documented in a different module.
diff --git a/src/qdoc/node.h b/src/qdoc/node.h
index 6b6c30fe1..424c84198 100644
--- a/src/qdoc/node.h
+++ b/src/qdoc/node.h
@@ -807,48 +807,6 @@ public:
bool isFirstClassAggregate() const override { return true; }
};
-class QmlPropertyNode : public Node
-{
-public:
- QmlPropertyNode(Aggregate *parent, const QString &name, const QString &type, bool attached);
-
- void setDataType(const QString &dataType) override { type_ = dataType; }
- void setStored(bool stored) { stored_ = toFlagValue(stored); }
- void setDesignable(bool designable) { designable_ = toFlagValue(designable); }
-
- const QString &dataType() const { return type_; }
- QString qualifiedDataType() const { return type_; }
- bool isReadOnlySet() const { return (readOnly_ != FlagValueDefault); }
- bool isStored() const { return fromFlagValue(stored_, true); }
- bool isDesignable() const { return fromFlagValue(designable_, false); }
- bool isWritable();
- bool isDefault() const override { return isdefault_; }
- bool isReadOnly() const override { return fromFlagValue(readOnly_, false); }
- bool isAlias() const override { return isAlias_; }
- bool isAttached() const override { return attached_; }
- 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 element() const override { return parent()->name(); }
-
- void markDefault() override { isdefault_ = true; }
- void markReadOnly(bool flag) override { readOnly_ = toFlagValue(flag); }
-
-private:
- PropertyNode *findCorrespondingCppProperty();
-
-private:
- QString type_;
- FlagValue stored_;
- FlagValue designable_;
- bool isAlias_;
- bool isdefault_;
- bool attached_;
- FlagValue readOnly_;
-};
-
class CollectionNode : public PageNode
{
public:
diff --git a/src/qdoc/qdoc.pro b/src/qdoc/qdoc.pro
index d02db4c82..f96cab177 100644
--- a/src/qdoc/qdoc.pro
+++ b/src/qdoc/qdoc.pro
@@ -63,6 +63,7 @@ HEADERS += atom.h \
qdocdatabase.h \
qdocindexfiles.h \
qdoctagfiles.h \
+ qmlpropertynode.h \
quoter.h \
sections.h \
separator.h \
@@ -107,6 +108,7 @@ SOURCES += atom.cpp \
qdocdatabase.cpp \
qdocindexfiles.cpp \
qdoctagfiles.cpp \
+ qmlpropertynode.cpp \
quoter.cpp \
sections.cpp \
separator.cpp \
diff --git a/src/qdoc/qdocindexfiles.cpp b/src/qdoc/qdocindexfiles.cpp
index e38757338..e54799d51 100644
--- a/src/qdoc/qdocindexfiles.cpp
+++ b/src/qdoc/qdocindexfiles.cpp
@@ -37,6 +37,7 @@
#include "loggingcategory.h"
#include "propertynode.h"
#include "qdocdatabase.h"
+#include "qmlpropertynode.h"
#include "typedefnode.h"
#include "variablenode.h"
diff --git a/src/qdoc/qmlpropertynode.cpp b/src/qdoc/qmlpropertynode.cpp
new file mode 100644
index 000000000..c41be1b89
--- /dev/null
+++ b/src/qdoc/qmlpropertynode.cpp
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmlpropertynode.h"
+
+#include "propertynode.h"
+#include "qdocdatabase.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ Constructor for the QML property node.
+ */
+QmlPropertyNode::QmlPropertyNode(Aggregate *parent, const QString &name, const QString &type,
+ bool attached)
+ : Node(parent->isJsType() ? JsProperty : QmlProperty, parent, name),
+ m_type(type),
+ m_attached(attached)
+{
+ if (m_type == "alias")
+ m_isAlias = true;
+ if (name.startsWith("__"))
+ setStatus(Internal);
+}
+
+/*!
+ Returns \c true if a QML property or attached property is
+ not read-only. The algorithm for figuring this out is long
+ amd tedious and almost certainly will break. It currently
+ doesn't work for the qmlproperty:
+
+ \code
+ bool PropertyChanges::explicit,
+ \endcode
+
+ ...because the tokenizer gets confused on \e{explicit}.
+ */
+bool QmlPropertyNode::isWritable()
+{
+ if (readOnly_ != FlagValueDefault)
+ return !fromFlagValue(readOnly_, false);
+
+ QmlTypeNode *qcn = qmlTypeNode();
+ if (qcn) {
+ if (qcn->cppClassRequired()) {
+ if (qcn->classNode()) {
+ PropertyNode *pn = findCorrespondingCppProperty();
+ if (pn)
+ return pn->isWritable();
+ else
+ defLocation().warning(
+ QStringLiteral(
+ "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(logicalModuleName())
+ .arg(qmlTypeName())
+ .arg(name()));
+ } else
+ defLocation().warning(QStringLiteral("No Q_PROPERTY for QML property %1::%2::%3 "
+ "in C++ class documented as QML type: "
+ "(C++ class not specified or not found).")
+ .arg(logicalModuleName())
+ .arg(qmlTypeName())
+ .arg(name()));
+ }
+ }
+ return true;
+}
+
+/*!
+ Returns a pointer this QML property's corresponding C++
+ property, if it has one.
+ */
+PropertyNode *QmlPropertyNode::findCorrespondingCppProperty()
+{
+ PropertyNode *pn;
+ Node *n = parent();
+ while (n && !(n->isQmlType() || n->isJsType()))
+ n = n->parent();
+ if (n) {
+ QmlTypeNode *qcn = static_cast<QmlTypeNode *>(n);
+ ClassNode *cn = qcn->classNode();
+ if (cn) {
+ /*
+ If there is a dot in the property name, first
+ find the C++ property corresponding to the QML
+ property group.
+ */
+ QStringList dotSplit = name().split(QChar('.'));
+ pn = cn->findPropertyNode(dotSplit[0]);
+ if (pn) {
+ /*
+ Now find the C++ property corresponding to
+ the QML property in the QML property group,
+ <group>.<property>.
+ */
+ if (dotSplit.size() > 1) {
+ QStringList path(extractClassName(pn->qualifiedDataType()));
+ Node *nn = QDocDatabase::qdocDB()->findClassNode(path);
+ if (nn) {
+ ClassNode *cn = static_cast<ClassNode *>(nn);
+ PropertyNode *pn2 = cn->findPropertyNode(dotSplit[1]);
+ /*
+ If found, return the C++ property
+ corresponding to the QML property.
+ Otherwise, return the C++ property
+ corresponding to the QML property
+ group.
+ */
+ return (pn2 ? pn2 : pn);
+ }
+ } else
+ return pn;
+ }
+ }
+ }
+ return nullptr;
+}
+
+QT_END_NAMESPACE
diff --git a/src/qdoc/qmlpropertynode.h b/src/qdoc/qmlpropertynode.h
new file mode 100644
index 000000000..2ab9d8bc5
--- /dev/null
+++ b/src/qdoc/qmlpropertynode.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMLPROPERTYNODE_H
+#define QMLPROPERTYNODE_H
+
+#include "node.h"
+
+#include <QtCore/qglobal.h>
+#include <QtCore/qstring.h>
+
+QT_BEGIN_NAMESPACE
+
+class QmlPropertyNode : public Node
+{
+public:
+ QmlPropertyNode(Aggregate *parent, const QString &name, const QString &type, bool attached);
+
+ void setDataType(const QString &dataType) override { m_type = dataType; }
+ void setStored(bool stored) { m_stored = toFlagValue(stored); }
+ void setDesignable(bool designable) { m_designable = toFlagValue(designable); }
+
+ const QString &dataType() const { return m_type; }
+ QString qualifiedDataType() const { return m_type; }
+ bool isReadOnlySet() const { return (readOnly_ != FlagValueDefault); }
+ bool isStored() const { return fromFlagValue(m_stored, true); }
+ bool isDesignable() const { return fromFlagValue(m_designable, false); }
+ bool isWritable();
+ bool isDefault() const override { return m_isDefault; }
+ bool isReadOnly() const override { return fromFlagValue(readOnly_, false); }
+ bool isAlias() const override { return m_isAlias; }
+ bool isAttached() const override { return m_attached; }
+ 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 element() const override { return parent()->name(); }
+
+ void markDefault() override { m_isDefault = true; }
+ void markReadOnly(bool flag) override { readOnly_ = toFlagValue(flag); }
+
+private:
+ PropertyNode *findCorrespondingCppProperty();
+
+private:
+ QString m_type {};
+ FlagValue m_stored { FlagValueDefault };
+ FlagValue m_designable { FlagValueDefault };
+ bool m_isAlias { false };
+ bool m_isDefault { false };
+ bool m_attached {};
+ FlagValue readOnly_ { FlagValueDefault };
+};
+
+QT_END_NAMESPACE
+
+#endif // QMLPROPERTYNODE_H
diff --git a/src/qdoc/qmlvisitor.cpp b/src/qdoc/qmlvisitor.cpp
index 9212818b0..00aff56ab 100644
--- a/src/qdoc/qmlvisitor.cpp
+++ b/src/qdoc/qmlvisitor.cpp
@@ -33,6 +33,7 @@
#include "functionnode.h"
#include "node.h"
#include "qdocdatabase.h"
+#include "qmlpropertynode.h"
#include "tokenizer.h"
#include <QtCore/qdebug.h>
diff --git a/src/qdoc/sections.cpp b/src/qdoc/sections.cpp
index 22855ae98..51ca9abe8 100644
--- a/src/qdoc/sections.cpp
+++ b/src/qdoc/sections.cpp
@@ -33,6 +33,7 @@
#include "functionnode.h"
#include "generator.h"
#include "loggingcategory.h"
+#include "qmlpropertynode.h"
#include "sharedcommentnode.h"
#include "typedefnode.h"
#include "variablenode.h"