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