diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2016-12-01 13:26:50 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-12-02 12:01:34 +0000 |
commit | 91010f426a05232c749843143c26731511fa1cb1 (patch) | |
tree | 45b3a1296176722950e85839138f78b54cb5a19c | |
parent | c3b5247161eff3b521381a9ada14b180e330a037 (diff) | |
download | qttools-91010f426a05232c749843143c26731511fa1cb1.tar.gz |
Fix build after changes to QtQML
This patch supports building against declarative before and after commit
6ed23b91b949b7edaf96cdb0f2bba7b21a02de89. A template specialization is
used instead of a function overload to avoid the compiler warning about
unused functions and aborting the build. This can be simplified once
qt5.git has been updated with declarative to contain the aforementioned
commit.
Change-Id: I9a1afdbaa70b6478bc5f51a833913fdc6cea1858
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | src/qdoc/qmlvisitor.cpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/qdoc/qmlvisitor.cpp b/src/qdoc/qmlvisitor.cpp index 033b37e43..ac64348d6 100644 --- a/src/qdoc/qmlvisitor.cpp +++ b/src/qdoc/qmlvisitor.cpp @@ -652,6 +652,30 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::UiArrayBinding *) { } +template <typename T> +QString qualifiedIdToString(T node); + +template <> +QString qualifiedIdToString(QStringRef node) +{ + return node.toString(); +} + +template <> +QString qualifiedIdToString(QQmlJS::AST::UiQualifiedId *node) +{ + QString s; + + for (QQmlJS::AST::UiQualifiedId *it = node; it; it = it->next) { + s.append(it->name); + + if (it->next) + s.append(QLatin1Char('.')); + } + + return s; +} + /*! Visits the public \a member declaration, which can be a signal or a property. It is a custom signal or property. @@ -674,8 +698,9 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiPublicMember *member) QVector<Parameter> parameters; for (QQmlJS::AST::UiParameterList *it = member->parameters; it; it = it->next) { - if (!it->type.isEmpty() && !it->name.isEmpty()) - parameters.append(Parameter(it->type.toString(), QString(), it->name.toString())); + const QString type = qualifiedIdToString(it->type); + if (!type.isEmpty() && !it->name.isEmpty()) + parameters.append(Parameter(type, QString(), it->name.toString())); } qmlSignal->setParameters(parameters); @@ -686,7 +711,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiPublicMember *member) } case QQmlJS::AST::UiPublicMember::Property: { - QString type = member->memberType.toString(); + QString type = qualifiedIdToString(member->memberType); QString name = member->name.toString(); if (current->isQmlType() || current->isJsType()) { QmlTypeNode *qmlType = static_cast<QmlTypeNode *>(current); |