Qt 5.10 Book Examples
chapter10
SyntaxHighlighter
SyntaxHighlighter.h
Go to the documentation of this file.
1
// ======================================================================
2
// SyntaxHighlighter.h
3
// ======================================================================
4
// This file is a part of the book
5
// "Qt 5.10 Professional programming with C++"
6
// http://qt-book.com
7
// ======================================================================
8
// Copyright (c) 2017 by Max Schlee
9
// ======================================================================
10
11
#pragma once
12
13
#include <QSyntaxHighlighter>
14
15
class
QTextDocument;
16
17
// ======================================================================
18
class
SyntaxHighlighter
:
public
QSyntaxHighlighter {
19
Q_OBJECT
20
private
:
21
QStringList m_lstKeywords;
22
23
protected
:
24
enum
{
NormalState
= -1,
InsideCStyleComment
,
InsideCString
};
25
26
virtual
void
highlightBlock
(
const
QString&);
27
28
QString
getKeyword
(
int
i,
const
QString& str)
const
;
29
30
public
:
31
SyntaxHighlighter
(QTextDocument* parent = 0);
32
};
SyntaxHighlighter::getKeyword
QString getKeyword(int i, const QString &str) const
Definition:
SyntaxHighlighter.cpp:96
SyntaxHighlighter::NormalState
Definition:
SyntaxHighlighter.h:24
SyntaxHighlighter
Definition:
SyntaxHighlighter.h:18
SyntaxHighlighter::InsideCString
Definition:
SyntaxHighlighter.h:24
SyntaxHighlighter::SyntaxHighlighter
SyntaxHighlighter(QTextDocument *parent=0)
Definition:
SyntaxHighlighter.cpp:15
SyntaxHighlighter::highlightBlock
virtual void highlightBlock(const QString &)
Definition:
SyntaxHighlighter.cpp:34
SyntaxHighlighter::InsideCStyleComment
Definition:
SyntaxHighlighter.h:24
Generated by
1.8.14