summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/qdocdatabase.cpp
diff options
context:
space:
mode:
authorMartin Smith <[email protected]>2014-03-12 10:09:49 +0100
committerThe Qt Project <[email protected]>2014-03-31 21:05:16 +0200
commit900c150a07f627c20ad68ec59253196d9960b034 (patch)
tree92fd5ab004e08c5e98f15fcafa940a6d5e948ef1 /src/tools/qdoc/qdocdatabase.cpp
parentc55d437d29a6fd014a1d47e1d2d05069879bf259 (diff)
qdoc: fix inheritance information for some QML types
This update fixes a bug introduced by the extensive changes for QTBUG-35377. For a QML base type loaded from an index file, its QML base type was not being resolved. This resulted in the "All members" page for some QML types to be incomplete because the pointer to the base type was 0 when it should have been set. This change also introduces the concept of "just in time" resolution for base type pointers, which appears to speed up qdoc a little. Task-number: QTBUG-37326 Change-Id: I5f09336ec70ba84029b44b245c56f7f8fe349757 Reviewed-by: Martin Smith <[email protected]>
Diffstat (limited to 'src/tools/qdoc/qdocdatabase.cpp')
-rw-r--r--src/tools/qdoc/qdocdatabase.cpp57
1 files changed, 36 insertions, 21 deletions
diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp
index 5aa1cbb61e5..289e57d16c9 100644
--- a/src/tools/qdoc/qdocdatabase.cpp
+++ b/src/tools/qdoc/qdocdatabase.cpp
@@ -754,6 +754,18 @@ void QDocDatabase::initializeDB()
*/
/*!
+ Looks up the QML type node identified by the qualified Qml
+ type \a name and returns a pointer to the QML type node.
+ */
+QmlClassNode* QDocDatabase::findQmlType(const QString& name)
+{
+ QmlClassNode* qcn = forest_.lookupQmlType(name);
+ if (qcn)
+ return qcn;
+ return 0;
+}
+
+/*!
Looks up the QML type node identified by the Qml module id
\a qmid and QML type \a name and returns a pointer to the
QML type node. The key is \a qmid + "::" + \a name.
@@ -1358,35 +1370,38 @@ const Node* QDocDatabase::findNodeForTarget(const QString& target, const Node* r
*/
void QDocDatabase::resolveQmlInheritance(InnerNode* root)
{
+ NodeMap previousSearches;
// Do 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 = 0;
- if (qcn->qmlBaseName().contains("::")) {
- bqcn = forest_.lookupQmlType(qcn->qmlBaseName());
- }
+ if (qcn->qmlBaseNodeNotSet() && !qcn->qmlBaseName().isEmpty()) {
+ QmlClassNode* bqcn = static_cast<QmlClassNode*>(previousSearches.value(qcn->qmlBaseName()));
+ if (bqcn)
+ qcn->setQmlBaseNode(bqcn);
else {
- const ImportList& imports = qcn->importList();
- for (int i=0; i<imports.size(); ++i) {
- bqcn = findQmlType(imports[i], qcn->qmlBaseName());
- if (bqcn)
- break;
+ if (!qcn->importList().isEmpty()) {
+ const ImportList& imports = qcn->importList();
+ for (int i=0; i<imports.size(); ++i) {
+ bqcn = findQmlType(imports[i], qcn->qmlBaseName());
+ if (bqcn)
+ break;
+ }
+ }
+ if (bqcn == 0) {
+ bqcn = findQmlType(QString(), qcn->qmlBaseName());
+ }
+ if (bqcn) {
+ qcn->setQmlBaseNode(bqcn);
+ previousSearches.insert(qcn->qmlBaseName(), bqcn);
}
- }
- if (bqcn == 0) {
- bqcn = findQmlType(QString(), qcn->qmlBaseName());
- }
- if (bqcn) {
- qcn->setQmlBaseNode(bqcn);
- }
#if 0
- else {
- qDebug() << "Temporary error message (ignore): UNABLE to resolve QML base type:"
- << qcn->qmlBaseName() << "for QML type:" << qcn->name();
- }
+ else {
+ qDebug() << "Temporary error message (ignore): UNABLE to resolve QML base type:"
+ << qcn->qmlBaseName() << "for QML type:" << qcn->name();
+ }
#endif
+ }
}
}
}