From 0ee6115998e39a7ebe8fe8ed63fc34ccef9128df Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Fri, 4 Jun 2010 10:10:01 +0200 Subject: [PATCH] qmljshighlighter: un-templatize setFormats() This is used excatly once. ReviewedBy: Kai Koehne --- src/plugins/qmljseditor/qmljseditor.cpp | 3 +-- src/plugins/qmljseditor/qmljshighlighter.cpp | 6 ++++++ src/plugins/qmljseditor/qmljshighlighter.h | 9 +-------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 1e06172687e..ec90ac3f6b5 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 36191c7dd9e..8ba5ab7ec58 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 69b1c684d02..3c33ebe7212 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; -- GitLab