diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp
index 4164010fb9f26c5947320f203b7a17bd0426a09b..591c1f2d163d703d6b540bed98e6995aef9cacba 100644
--- a/src/plugins/cpptools/cppcodeformatter.cpp
+++ b/src/plugins/cpptools/cppcodeformatter.cpp
@@ -678,6 +678,7 @@ bool CodeFormatter::tryDeclaration()
             QString tokenText = currentTokenText().toString();
             if (tokenText.startsWith(QLatin1String("Q_"))
                     || tokenText.startsWith(QLatin1String("QT_"))
+                    || tokenText.startsWith(QLatin1String("QML_"))
                     || tokenText.startsWith(QLatin1String("QDOC_"))) {
                 enter(qt_like_macro);
                 return true;
diff --git a/tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp b/tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp
index fb2ee61b0258d61cbbb0d2186334b993554b094b..c08644980566124a35e7d0affd3524f225aec614 100644
--- a/tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp
+++ b/tests/auto/cplusplus/codeformatter/tst_codeformatter.cpp
@@ -299,6 +299,8 @@ void tst_CodeFormatter::macrosNoSemicolon()
          << Line("int i;")
          << Line("Q_BLABLA();")
          << Line("int i;")
+         << Line("QML_DECLARE_TYPE(a, b, c, d)")
+         << Line("int i;")
          << Line("Q_PROPERTY(abc)")
          << Line("QDOC_PROPERTY(abc)")
          << Line("void foo() {")