Commit ba890501 authored by Laurent Montel's avatar Laurent Montel 😁

Try to make select working

parent c48ee6d5
......@@ -39,15 +39,18 @@ void GrammarResultTextEdit::applyGrammarResult(const QVector<GrammalecteGrammarE
{
for (const GrammalecteGrammarError &info : infos) {
//Block id based on 1 not 0 as QTextDocument (perhaps remove -1 when loading ?)
QTextBlock block = document()->findBlock(info.blockId() - 1);
QTextBlock block = document()->findBlockByNumber(info.blockId() - 1);
if (block.isValid()) {
QTextCursor cur(block);
//TODO
const int position = cur.position();
QTextCharFormat format;
format.setBackground(info.color());
cur.setPosition(position + info.begin());
cur.setPosition(position + info.end(), QTextCursor::KeepAnchor);
cur.mergeCharFormat(format);
} else {
qCWarning(KMAIL_EDITOR_GRAMMALECTE_PLUGIN_LOG) << "Unable to find block Id" << (info.blockId() -1);
}
//TODO
}
//TOOD
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment