Add common interface for text formats inside syntax highlighter

Change-Id: I87f64446161a57aea0896f68e4eafacef791969b
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
jkobus
2013-08-13 12:57:31 +02:00
committed by Jarek Kobus
parent 760aa0f8bc
commit e8801167aa
69 changed files with 489 additions and 531 deletions

View File

@@ -31,7 +31,7 @@
#define TEXTEDITOR_SYNTAXHIGHLIGHTER_H
#include "texteditor_global.h"
#include <texteditor/texteditorconstants.h>
#include <QObject>
#include <QTextLayout>
@@ -48,6 +48,7 @@ QT_END_NAMESPACE
namespace TextEditor {
class BaseTextDocument;
class FontSettings;
class SyntaxHighlighterPrivate;
class TEXTEDITOR_EXPORT SyntaxHighlighter : public QObject
@@ -68,11 +69,15 @@ public:
static QList<QColor> generateColors(int n, const QColor &background);
// Don't call in constructors of derived classes
virtual void setFontSettings(const TextEditor::FontSettings &fontSettings);
public Q_SLOTS:
void rehighlight();
void rehighlightBlock(const QTextBlock &block);
protected:
void setTextFormatCategories(const QVector<TextEditor::TextStyle> &categories);
QTextCharFormat formatForCategory(int categoryIndex) const;
virtual void highlightBlock(const QString &text) = 0;
void setFormat(int start, int count, const QTextCharFormat &format);