0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 00:33:02 +03:00

Script highlighter changed

This commit is contained in:
Arin Alexander 2018-04-04 00:22:44 +03:00
parent ab3236f669
commit bea84a3320
2 changed files with 2 additions and 8 deletions

View File

@ -1,4 +1,5 @@
#include "lrscripthighlighter.h"
#include "lrglobal.h"
#include <QDebug>
#include <QPalette>
@ -180,17 +181,11 @@ bool ScriptHighlighter::isKeyWord(const QString& word)
return false;
}
bool ScriptHighlighter::isDark(QColor color)
{
double a = 1 - ( 0.299 * color.red() + 0.587 * color.green() + 0.114 * color.blue()) / 255;
return (a < 0.5);
}
ScriptHighlighter::ScriptHighlighter(QTextDocument* parent):
QSyntaxHighlighter(parent)
{
if ( isDark(QPalette().background().color())){
if ( isColorDark(QPalette().background().color())){
m_formats[NumberFormat].setForeground(Qt::darkBlue);
m_formats[StringFormat].setForeground(Qt::darkGreen);
m_formats[KeywordFormat].setForeground(Qt::darkYellow);

View File

@ -42,7 +42,6 @@ protected:
};
QTextCharFormat m_formats[FormatsCount];
bool isKeyWord(const QString& word);
bool isDark(QColor color);
void createParentheisisInfo(const char& literal, TextBlockData *data, const QString& text);
};