diff --git a/src/plugins/cppeditor/cppdoxygen_test.cpp b/src/plugins/cppeditor/cppdoxygen_test.cpp index 639e0d5b8ae..79e4e9f2d91 100644 --- a/src/plugins/cppeditor/cppdoxygen_test.cpp +++ b/src/plugins/cppeditor/cppdoxygen_test.cpp @@ -295,6 +295,20 @@ void DoxygenTest::testBasic_data() " */\n" "API void f();\n" ); + + QTest::newRow("withAccessSpecifierBeforeFunction") << _( + "class C {\n" + " /**|\n" + " public: void f();\n" + "};\n" + ) << _( + "class C {\n" + " /**\n" + " * @brief f\n" + " */\n" + " public: void f();\n" + "};\n" + ); } void DoxygenTest::testBasic() diff --git a/src/plugins/cpptools/doxygengenerator.cpp b/src/plugins/cpptools/doxygengenerator.cpp index 398a31a8764..ae4ac88a59f 100644 --- a/src/plugins/cpptools/doxygengenerator.cpp +++ b/src/plugins/cpptools/doxygengenerator.cpp @@ -116,7 +116,7 @@ QString DoxygenGenerator::generate(QTextCursor cursor, declCandidate.replace(attribute, ""); declCandidate.replace("Q_INVOKABLE", ""); - + declCandidate.remove(QRegularExpression(R"(\s*(public|protected|private)\s*:\s*)")); declCandidate.replace(QChar::ParagraphSeparator, QLatin1Char('\n')); // Let's append a closing brace in the case we got content like 'class MyType {'