diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index c614daf45eb025666811992997880cbac7ef1813..c7688c986bd5c7ec144c39fb41909933de42c171 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -1435,6 +1435,8 @@ bool Preprocessor::isQtReservedWord(const QByteArray &macroId) const
         return true;
     else if (size == 7 && macroId.at(0) == 's' && macroId == "signals")
         return true;
+    else if (size == 7 && macroId.at(0) == 'f' && macroId == "foreach")
+        return true;
     else if (size == 5 && macroId.at(0) == 's' && macroId == "slots")
         return true;
     return false;
diff --git a/src/shared/cplusplus/Keywords.cpp b/src/shared/cplusplus/Keywords.cpp
index e26244a0af72c48e637d7773acf2f2f74d17c4dc..3d8fc434f5ec51560b5d2f34c6873ee20ddaa6b0 100644
--- a/src/shared/cplusplus/Keywords.cpp
+++ b/src/shared/cplusplus/Keywords.cpp
@@ -620,6 +620,21 @@ static inline int classify7(const char *s, bool q) {
       }
     }
   }
+  else if (q && s[0] == 'f') {
+    if (s[1] == 'o') {
+      if (s[2] == 'r') {
+        if (s[3] == 'e') {
+          if (s[4] == 'a') {
+            if (s[5] == 'c') {
+              if (s[6] == 'h') {
+                return T_Q_FOREACH;
+              }
+            }
+          }
+        }
+      }
+    }
+  }
   else if (q && s[0] == 's') {
     if (s[1] == 'i') {
       if (s[2] == 'g') {
diff --git a/src/shared/cplusplus/Token.cpp b/src/shared/cplusplus/Token.cpp
index 6e5e428c2dbd7511db32adc7c3c57219c83a3e77..37a95d6cd772d4c12bb5986ef1454ad27e25a6bf 100644
--- a/src/shared/cplusplus/Token.cpp
+++ b/src/shared/cplusplus/Token.cpp
@@ -90,7 +90,7 @@ static const char *token_names[] = {
     ("@protected"), ("@protocol"), ("@public"), ("@required"), ("@selector"),
     ("@synchronized"), ("@synthesize"), ("@throw"), ("@try"),
 
-    ("SIGNAL"), ("SLOT"), ("Q_SIGNAL"), ("Q_SLOT"), ("signals"), ("slots")
+    ("SIGNAL"), ("SLOT"), ("Q_SIGNAL"), ("Q_SLOT"), ("signals"), ("slots"), ("Q_FOREACH")
 };
 
 Token::Token() :