6 #ifndef QT4TEXTFORMATTER_H_
7 #define QT4TEXTFORMATTER_H_
9 #include <QTextCharFormat>
10 #include <QSyntaxHighlighter>
12 #include "TextFormatter.h"
16 class Qt4SyntaxHighlighter;
49 const QTextCharFormat &getQTextCharFormat()
const {
53 virtual void setQSyntaxHighlighter(QSyntaxHighlighter *qSyntaxHighlighter_);
61 void format(
const std::string &s,
const srchilite::FormatterParams *params);
78 return textFormat.fontWeight() == QFont::Bold;
81 void setBold(
bool b) {
82 textFormat.setFontWeight(b ? QFont::Bold : QFont::Normal);
85 bool isItalic()
const {
86 return textFormat.fontItalic();
89 void setItalic(
bool i) {
90 textFormat.setFontItalic(i);
93 bool isUnderline()
const {
94 return textFormat.fontUnderline();
97 void setUnderline(
bool u) {
98 textFormat.setFontUnderline(u);
101 bool isMonospace()
const {
102 return textFormat.fontFamily() ==
"Monospace";
105 void setMonospace(
bool m) {
107 textFormat.setFontFamily(
"Monospace");
115 void setForegroundColor(
const QColor &color);
122 void setBackgroundColor(
const QColor &color);
QTextCharFormat textFormat
The format represented by this formatter.
Definition: Qt4TextFormatter.h:26
Definition: ColorDialog.cpp:12
const QColor & getForegroundColor() const
Definition: Qt4TextFormatter.h:111
Qt4SyntaxHighlighter * qSyntaxHighlighter
The reference to QSyntaxHighlighter object.
Definition: Qt4TextFormatter.h:43
QColor foregroundColor
the (possibly invalid) foreground color.
Definition: Qt4TextFormatter.h:31
QColor backgroundColor
the (possibly invalid) background color
Definition: Qt4TextFormatter.h:34
The implementation of TextFormatter for Qt4, relying on QTextCharFormat.
Definition: Qt4TextFormatter.h:21
const QString toSourceHighlightStyleString() const
Starting from this formatter, it builds a string representation using the syntax of source-highlight ...
Definition: Qt4TextFormatter.cpp:79
A specialization of srchilite::Formatter in order to format parts of a document, instead of outputtin...
Definition: TextFormatter.h:30
const QColor & getBackgroundColor() const
Definition: Qt4TextFormatter.h:118
const QString toString() const
Definition: Qt4TextFormatter.cpp:57
void format(const std::string &s, const srchilite::FormatterParams *params)
Formats the passed string.
Definition: Qt4TextFormatter.cpp:39
An implementation of QSyntaxHighlighter using GNU Source-highlight library (by relying on GNUSyntaxHi...
Definition: Qt4SyntaxHighlighter.h:38