待用错误格式
This commit is contained in:
parent
c1435484d3
commit
1166dc52ae
|
@ -1,6 +1,7 @@
|
||||||
#include "chainhightlighter.h"
|
#include "chainhightlighter.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
using namespace Parse;
|
||||||
using namespace Enhancement;
|
using namespace Enhancement;
|
||||||
|
|
||||||
ChainHightlighter::ChainHightlighter(QObject *parent)
|
ChainHightlighter::ChainHightlighter(QObject *parent)
|
||||||
|
@ -20,17 +21,25 @@ void ChainHightlighter::highlightBlock(const QString &text)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QTextCharFormat unknowns;
|
QTextCharFormat unknowns;
|
||||||
unknowns.setForeground(QBrush(Qt::red));
|
unknowns.setForeground(QBrush(Qt::gray));
|
||||||
|
|
||||||
QTextCharFormat generate;
|
QTextCharFormat generate;
|
||||||
generate.setForeground(QBrush(Qt::blue));
|
generate.setForeground(QBrush(Qt::black));
|
||||||
|
|
||||||
|
QTextCharFormat error;
|
||||||
|
error.setForeground(QBrush(Qt::red));
|
||||||
|
|
||||||
auto block = currentBlock();
|
auto block = currentBlock();
|
||||||
auto words = parse_core->getWords(block.blockNumber());
|
auto words = parse_core->getWords(block.blockNumber());
|
||||||
for(auto &w : words){
|
for(auto &w : words){
|
||||||
|
QList<ErrorMessage> xerrors;
|
||||||
|
|
||||||
if(w->host() == parse_core->unknowns()){
|
if(w->host() == parse_core->unknowns()){
|
||||||
setFormat(w->column()-1, w->toString().length(), unknowns);
|
setFormat(w->column()-1, w->toString().length(), unknowns);
|
||||||
}
|
}
|
||||||
|
else if(!w->host()->check(xerrors)){
|
||||||
|
setFormat(w->column()-1, w->toString().length(), error);
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
setFormat(w->column()-1, w->toString().length(), generate);
|
setFormat(w->column()-1, w->toString().length(), generate);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue