-
Notifications
You must be signed in to change notification settings - Fork 0
/
highlighter.h
44 lines (33 loc) · 1.02 KB
/
highlighter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** Copyright (C) 2010 Interhost AS - www.interhost.no
** Distributed under the terms of the GNU General Public License v3
**
****************************************************************************/
#ifndef HIGHLIGHTER_H
#define HIGHLIGHTER_H
#include <QSyntaxHighlighter>
#include <QHash>
#include <QTextCharFormat>
QT_BEGIN_NAMESPACE
class QTextDocument;
class QColor;
class QStringListModel;
QT_END_NAMESPACE
class Highlighter : public QSyntaxHighlighter
{
Q_OBJECT
public:
Highlighter(QTextDocument *parent = 0);
public slots:
void setModel(QStringListModel * matchWords);
void setColor(const QColor & color);
protected:
void highlightBlock(const QString &text);
void highlightBlock(const QString &text, const QString &pattern, const QTextCharFormat & highlightFormat);
private:
QStringListModel * matchWords;
QTextCharFormat format;
};
#endif