diff --git a/src/plugins/qt4projectmanager/profileeditor.cpp b/src/plugins/qt4projectmanager/profileeditor.cpp
index 8b79faf1836b41d65a1f2d9f084e50ae87176d53..d7cf57278afc8714762b483bb2b76a3df5183e5a 100644
--- a/src/plugins/qt4projectmanager/profileeditor.cpp
+++ b/src/plugins/qt4projectmanager/profileeditor.cpp
@@ -140,7 +140,8 @@ void ProFileEditor::setFontSettings(const TextEditor::FontSettings &fs)
     if (categories.isEmpty()) {
         categories << QLatin1String(TextEditor::Constants::C_TYPE)
                    << QLatin1String(TextEditor::Constants::C_KEYWORD)
-                   << QLatin1String(TextEditor::Constants::C_COMMENT);
+                   << QLatin1String(TextEditor::Constants::C_COMMENT)
+                   << QLatin1String(TextEditor::Constants::C_VISUAL_WHITESPACE);
     }
 
     const QVector<QTextCharFormat> formats = fs.toTextCharFormats(categories);
diff --git a/src/plugins/qt4projectmanager/profilehighlighter.cpp b/src/plugins/qt4projectmanager/profilehighlighter.cpp
index cf9e72d2ca06cc9cf3325c2e0c1ef6f3a22241a4..14daeee9f6338e590f59652e13d0348c00c62b60 100644
--- a/src/plugins/qt4projectmanager/profilehighlighter.cpp
+++ b/src/plugins/qt4projectmanager/profilehighlighter.cpp
@@ -201,5 +201,6 @@ void ProFileHighlighter::highlightBlock(const QString &text)
         if (i >= text.length())
             break;
     }
-}
 
+    applyFormatToSpaces(text, m_formats[ProfileVisualWhitespaceFormat]);
+}
diff --git a/src/plugins/qt4projectmanager/profilehighlighter.h b/src/plugins/qt4projectmanager/profilehighlighter.h
index 87dadce27e147a3c2a034c52186121efc6e3b4ca..78ede9d738c07c5e9a7910a028e481bb3c6a5588 100644
--- a/src/plugins/qt4projectmanager/profilehighlighter.h
+++ b/src/plugins/qt4projectmanager/profilehighlighter.h
@@ -46,6 +46,7 @@ public:
         ProfileVariableFormat,
         ProfileFunctionFormat,
         ProfileCommentFormat,
+        ProfileVisualWhitespaceFormat,
         NumProfileFormats
     };
 
diff --git a/src/plugins/texteditor/generichighlighter/highlighter.cpp b/src/plugins/texteditor/generichighlighter/highlighter.cpp
index 98de86d7fa59c1646efeac9cd1f171861bd91b6a..3775a63d51f3633800a1a717bf5bad1c09d5f88b 100644
--- a/src/plugins/texteditor/generichighlighter/highlighter.cpp
+++ b/src/plugins/texteditor/generichighlighter/highlighter.cpp
@@ -140,7 +140,7 @@ void Highlighter::highlightBlock(const QString &text)
         }
     }
 
-    applyVisualWhitespaceFormat(text);
+    applyFormatToSpaces(text, m_creatorFormats.value(VisualWhitespace));
 }
 
 void Highlighter::setupDataForBlock(const QString &text)
@@ -408,22 +408,6 @@ void Highlighter::applyFormat(int offset,
     }
 }
 
-void Highlighter::applyVisualWhitespaceFormat(const QString &text)
-{
-    int offset = 0;
-    const int length = text.length();
-    while (offset < length) {
-        if (text.at(offset).isSpace()) {
-            int start = offset++;
-            while (offset < length && text.at(offset).isSpace())
-                ++offset;
-            setFormat(start, offset - start, m_creatorFormats.value(VisualWhitespace));
-        } else {
-            ++offset;
-        }
-    }
-}
-
 void Highlighter::createWillContinueBlock()
 {
     BlockData *data = blockData(currentBlockUserData());
diff --git a/src/plugins/texteditor/generichighlighter/highlighter.h b/src/plugins/texteditor/generichighlighter/highlighter.h
index 43b7b58df3ed2411cc731a6398c1ae99a01cf570..0741797259579017ec799f5b9f4ed06e6c4dfc84 100644
--- a/src/plugins/texteditor/generichighlighter/highlighter.h
+++ b/src/plugins/texteditor/generichighlighter/highlighter.h
@@ -123,7 +123,6 @@ private:
                      int count,
                      const QString &itemDataName,
                      const QSharedPointer<HighlightDefinition> &definition);
-    void applyVisualWhitespaceFormat(const QString &text);
 
     void applyRegionBasedFolding() const;
     void applyIndentationBasedFolding(const QString &text) const;
diff --git a/src/plugins/texteditor/syntaxhighlighter.cpp b/src/plugins/texteditor/syntaxhighlighter.cpp
index b02d6ef9c6c53e8597ff6e6ac87fc1840968559a..346c735b26f03b256ca1431db2dce4fe66befc71 100644
--- a/src/plugins/texteditor/syntaxhighlighter.cpp
+++ b/src/plugins/texteditor/syntaxhighlighter.cpp
@@ -535,6 +535,22 @@ void SyntaxHighlighter::setFormat(int start, int count, const QFont &font)
     setFormat(start, count, format);
 }
 
+void SyntaxHighlighter::applyFormatToSpaces(const QString &text, const QTextCharFormat &format)
+{
+    int offset = 0;
+    const int length = text.length();
+    while (offset < length) {
+        if (text.at(offset).isSpace()) {
+            int start = offset++;
+            while (offset < length && text.at(offset).isSpace())
+                ++offset;
+            setFormat(start, offset - start, format);
+        } else {
+            ++offset;
+        }
+    }
+}
+
 /*!
     \fn QTextCharFormat SyntaxHighlighter::format(int position) const
 
diff --git a/src/plugins/texteditor/syntaxhighlighter.h b/src/plugins/texteditor/syntaxhighlighter.h
index 5b6722b5a34dcb60d72d31e3f1a5803ea669b2a4..a010facf640335adcc4e81bc9f082cfd7ab69c0c 100644
--- a/src/plugins/texteditor/syntaxhighlighter.h
+++ b/src/plugins/texteditor/syntaxhighlighter.h
@@ -89,6 +89,8 @@ protected:
     void setFormat(int start, int count, const QFont &font);
     QTextCharFormat format(int pos) const;
 
+    void applyFormatToSpaces(const QString &text, const QTextCharFormat &format);
+
     int previousBlockState() const;
     int currentBlockState() const;
     void setCurrentBlockState(int newState);