diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index 1e06172687e5e8903a23f69e7798e5728e63e21d..ec90ac3f6b532be58a6aa08716a5162332324cc0 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -915,8 +915,7 @@ void QmlJSTextEditor::setFontSettings(const TextEditor::FontSettings &fs)
                 << QLatin1String(TextEditor::Constants::C_VISUAL_WHITESPACE);
     }
 
-    const QVector<QTextCharFormat> formats = fs.toTextCharFormats(categories);
-    highlighter->setFormats(formats.constBegin(), formats.constEnd());
+    highlighter->setFormats(fs.toTextCharFormats(categories));
     highlighter->rehighlight();
 
     m_occurrencesFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES));
diff --git a/src/plugins/qmljseditor/qmljshighlighter.cpp b/src/plugins/qmljseditor/qmljshighlighter.cpp
index 36191c7dd9e699a537176850ddf0e5f4a570d3a9..8ba5ab7ec58b0b6aa31750b5b36ab1bbe6c09f66 100644
--- a/src/plugins/qmljseditor/qmljshighlighter.cpp
+++ b/src/plugins/qmljseditor/qmljshighlighter.cpp
@@ -82,6 +82,12 @@ static bool checkStartOfBinding(const Token &token)
     } // end of switch
 }
 
+void Highlighter::setFormats(const QVector<QTextCharFormat> &formats)
+{
+    QTC_ASSERT(formats.size() == NumFormats, return);
+    qCopy(formats.begin(), formats.end(), m_formats);
+}
+
 void Highlighter::highlightBlock(const QString &text)
 {
     const QList<Token> tokens = m_scanner(text, onBlockStart());
diff --git a/src/plugins/qmljseditor/qmljshighlighter.h b/src/plugins/qmljseditor/qmljshighlighter.h
index 69b1c684d02b5ef2f9c422e76febcfa42b48709c..3c33ebe721266d726bf8901f276cd14c10e0cb60 100644
--- a/src/plugins/qmljseditor/qmljshighlighter.h
+++ b/src/plugins/qmljseditor/qmljshighlighter.h
@@ -63,14 +63,7 @@ public:
 
     bool isQmlEnabled() const;
     void setQmlEnabled(bool duiEnabled);
-
-    // MS VC 6 compatible, still.
-    // Set formats from a sequence of type QTextCharFormat
-    template <class InputIterator>
-    void setFormats(InputIterator begin, InputIterator end)
-    {
-        qCopy(begin, end, m_formats);
-    }
+    void setFormats(const QVector<QTextCharFormat> &formats);
 
     QTextCharFormat labelTextCharFormat() const;