qdoc: Corrected error in QDocDatabase::findQmlType()
It was still using the QML module version number as part of the search key. e.g. it tried to find the type node for QtQuick.Controls::Button using QtQuick.Controls2.Button, but now it searches without the 2. Task-number: QTBUG-34173 Change-Id: Ibc8b6d9ef4ceebb20c1be00ec3bc9190c51bcdf3 Reviewed-by: Topi Reiniö <topi.reinio@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Nico Vertriest <nico.vertriest@digia.com>bb10
parent
6893a0d656
commit
e9fe369321
|
|
@ -357,23 +357,10 @@ QmlClassNode* QDocDatabase::findQmlType(const ImportRec& import, const QString&
|
|||
else
|
||||
qmName = import.importUri_;
|
||||
for (int i=0; i<dotSplit.size(); ++i) {
|
||||
QString qmid = qmName + import.version_;
|
||||
QString qualifiedName = qmid + "::" + dotSplit[i];
|
||||
QString qualifiedName = qmName + "::" + dotSplit[i];
|
||||
QmlClassNode* qcn = qmlTypeMap_.value(qualifiedName);
|
||||
if (qcn) {
|
||||
if (qcn)
|
||||
return qcn;
|
||||
}
|
||||
if (import.version_.size() > 1) {
|
||||
int dot = import.version_.lastIndexOf(QChar('.'));
|
||||
if (dot > 0) {
|
||||
qmid = import.name_ + import.version_.left(dot);
|
||||
qualifiedName = qmid + "::" + dotSplit[i];
|
||||
qcn = qmlTypeMap_.value(qualifiedName);
|
||||
if (qcn) {
|
||||
return qcn;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1000,24 +987,6 @@ void QDocDatabase::resolveQmlInheritance(InnerNode* root)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void QDocDatabase::resolveQmlInheritance(InnerNode* root)
|
||||
{
|
||||
// Dop we need recursion?
|
||||
foreach (Node* child, root->childNodes()) {
|
||||
if (child->type() == Node::Document && child->subType() == Node::QmlClass) {
|
||||
QmlClassNode* qcn = static_cast<QmlClassNode*>(child);
|
||||
if ((qcn->qmlBaseNode() == 0) && !qcn->qmlBaseName().isEmpty()) {
|
||||
QmlClassNode* bqcn = findQmlType(QString(), qcn->qmlBaseName());
|
||||
if (bqcn) {
|
||||
qcn->setQmlBaseNode(bqcn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
*/
|
||||
void QDocDatabase::resolveTargets(InnerNode* root)
|
||||
|
|
|
|||
|
|
@ -464,6 +464,7 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition)
|
|||
QmlClassNode *component = new QmlClassNode(current, name);
|
||||
component->setTitle(name);
|
||||
component->setImportList(importList);
|
||||
importList.clear();
|
||||
if (applyDocumentation(definition->firstSourceLocation(), component)) {
|
||||
QmlClassNode::addInheritedBy(type, component);
|
||||
component->setQmlBaseName(type);
|
||||
|
|
@ -488,34 +489,21 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::UiObjectDefinition *definition)
|
|||
lastEndOffset = definition->lastSourceLocation().end();
|
||||
}
|
||||
|
||||
/*!
|
||||
Note that the imports list can be traversed by iteration to obtain
|
||||
all the imports in the document at once, having found just one:
|
||||
|
||||
*it = imports; it; it = it->next
|
||||
|
||||
*/
|
||||
bool QmlDocVisitor::visit(QQmlJS::AST::UiImportList *imports)
|
||||
bool QmlDocVisitor::visit(QQmlJS::AST::UiImport *import)
|
||||
{
|
||||
while (imports != 0) {
|
||||
QQmlJS::AST::UiImport* imp = imports->import;
|
||||
QString name = document.mid(import->fileNameToken.offset, import->fileNameToken.length);
|
||||
if (name[0] == '\"')
|
||||
name = name.mid(1, name.length()-2);
|
||||
QString version = document.mid(import->versionToken.offset, import->versionToken.length);
|
||||
QString importId = document.mid(import->importIdToken.offset, import->importIdToken.length);
|
||||
QString importUri = getFullyQualifiedId(import->importUri);
|
||||
QString reconstructed = importUri + QString(" ") + version;
|
||||
importList.append(ImportRec(name, version, importId, importUri));
|
||||
|
||||
QString name = document.mid(imp->fileNameToken.offset, imp->fileNameToken.length);
|
||||
if (name[0] == '\"')
|
||||
name = name.mid(1, name.length()-2);
|
||||
QString version = document.mid(imp->versionToken.offset, imp->versionToken.length);
|
||||
QString importId = document.mid(imp->importIdToken.offset, imp->importIdToken.length);
|
||||
QString importUri = getFullyQualifiedId(imp->importUri);
|
||||
importList.append(ImportRec(name, version, importId, importUri));
|
||||
imports = imports->next;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
End the visit of the imports list.
|
||||
*/
|
||||
void QmlDocVisitor::endVisit(QQmlJS::AST::UiImportList *definition)
|
||||
void QmlDocVisitor::endVisit(QQmlJS::AST::UiImport *definition)
|
||||
{
|
||||
lastEndOffset = definition->lastSourceLocation().end();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,8 +75,8 @@ public:
|
|||
const QSet<QString> &topics);
|
||||
virtual ~QmlDocVisitor();
|
||||
|
||||
bool visit(QQmlJS::AST::UiImportList *imports);
|
||||
void endVisit(QQmlJS::AST::UiImportList *definition);
|
||||
bool visit(QQmlJS::AST::UiImport *import);
|
||||
void endVisit(QQmlJS::AST::UiImport *definition);
|
||||
|
||||
bool visit(QQmlJS::AST::UiObjectDefinition *definition);
|
||||
void endVisit(QQmlJS::AST::UiObjectDefinition *definition);
|
||||
|
|
|
|||
Loading…
Reference in New Issue