diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp
index a1f08a02f142b9ce4a4bfe561332e5406cdd01d5..3e28a2025a8bed2cebe69481473eb791769c8c5d 100644
--- a/src/plugins/cppeditor/cppquickfix_test.cpp
+++ b/src/plugins/cppeditor/cppquickfix_test.cpp
@@ -325,6 +325,50 @@ void CppEditorPlugin::test_quickfix_data()
         "}\n"
     );
 
+    // Checks: Enum type in class is found.
+    QTest::newRow("CompleteSwitchCaseStatement_enumTypeInClass")
+        << CppQuickFixFactoryPtr(new CompleteSwitchCaseStatement) << _(
+        "struct C { enum EnumType { V1, V2 }; };\n"
+        "\n"
+        "void f(C::EnumType t) {\n"
+        "    @switch (t) {\n"
+        "    }\n"
+        "}\n"
+        ) << _(
+        "struct C { enum EnumType { V1, V2 }; };\n"
+        "\n"
+        "void f(C::EnumType t) {\n"
+        "    switch (t) {\n"
+        "    case C::V1:\n"
+        "        break;\n"
+        "    case C::V2:\n"
+        "        break;\n"
+        "    }\n"
+        "}\n"
+    );
+
+    // Checks: Enum type in namespace is found.
+    QTest::newRow("CompleteSwitchCaseStatement_enumTypeInNamespace")
+        << CppQuickFixFactoryPtr(new CompleteSwitchCaseStatement) << _(
+        "namespace N { enum EnumType { V1, V2 }; };\n"
+        "\n"
+        "void f(N::EnumType t) {\n"
+        "    @switch (t) {\n"
+        "    }\n"
+        "}\n"
+        ) << _(
+        "namespace N { enum EnumType { V1, V2 }; };\n"
+        "\n"
+        "void f(N::EnumType t) {\n"
+        "    switch (t) {\n"
+        "    case N::V1:\n"
+        "        break;\n"
+        "    case N::V2:\n"
+        "        break;\n"
+        "    }\n"
+        "}\n"
+    );
+
     // Checks: The missing enum value is added.
     QTest::newRow("CompleteSwitchCaseStatement_oneValueMissing")
         << CppQuickFixFactoryPtr(new CompleteSwitchCaseStatement) << _(
diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp
index be1b34834094034e3dbae521e8c5a156ad91fb5f..dfdcfbc18f2a0f4e014320077fcaf55946a28a4f 100644
--- a/src/plugins/cppeditor/cppquickfixes.cpp
+++ b/src/plugins/cppeditor/cppquickfixes.cpp
@@ -2293,6 +2293,8 @@ Enum *findEnum(const QList<LookupItem> &results, const LookupContext &ctxt)
             if (ClassOrNamespace *con = ctxt.lookupType(namedType->name(), result.scope())) {
                 const QList<Enum *> enums = con->unscopedEnums();
                 const Name *referenceName = namedType->name();
+                if (const QualifiedNameId *qualifiedName = referenceName->asQualifiedNameId())
+                    referenceName = qualifiedName->name();
                 foreach (Enum *e, enums) {
                     if (const Name *candidateName = e->name()) {
                         if (candidateName->match(referenceName))