From 031776378153703635524a6f14dbd6aaa3374224 Mon Sep 17 00:00:00 2001
From: Martin Smith <martin.smith@digia.com>
Date: Tue, 7 May 2013 09:46:35 +0200
Subject: [PATCH] qdoc: Documentation for QMetaObject::Connection now appears

qdoc's faux C++ parser did not recognize class declarations
of the form:

class Name1::Name2 {
...
};

...where class Name2 is nested in class Name1. Now it does,
but this fix doesn't handle deeper nestings. doc needs a
proper C++ parser.

Task-number: QTBUG-28664
Change-Id: I5adf88cc1b2ce03f5565250734416bf9592914b5
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
---
 src/tools/qdoc/cppcodeparser.cpp | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp
index 68edb1336a7..41fe2f775ce 100644
--- a/src/tools/qdoc/cppcodeparser.cpp
+++ b/src/tools/qdoc/cppcodeparser.cpp
@@ -1598,7 +1598,11 @@ bool CppCodeParser::matchBaseList(ClassNode *classe, bool isClass)
 }
 
 /*!
-  Parse a C++ class, union, or struct declarion.
+  Parse a C++ class, union, or struct declaration.
+
+  This function only handles one level of class nesting, but that is
+  sufficient for Qt because there are no cases of class nesting more
+  than one level deep.
  */
 bool CppCodeParser::matchClassDecl(InnerNode *parent,
                                    const QString &templateStuff)
@@ -1612,6 +1616,18 @@ bool CppCodeParser::matchClassDecl(InnerNode *parent,
         return false;
     while (tok == Tok_Ident)
         readToken();
+    if (tok == Tok_Gulbrandsen) {
+        Node* n = parent->findChildNodeByNameAndType(previousLexeme(),Node::Class);
+        if (n) {
+            parent = static_cast<InnerNode*>(n);
+            if (parent) {
+                readToken();
+                if (tok != Tok_Ident)
+                    return false;
+                readToken();
+            }
+        }
+    }
     if (tok != Tok_Colon && tok != Tok_LeftBrace)
         return false;
 
-- 
GitLab